Discussion:
[Inkscape-devel] Replace soft-hyphenation character with a hard-hyphenation
Stefan de Konink
2008-10-30 15:46:13 UTC
Permalink
Hi,


I'm trying to get soft-hyphenation to work in an acceptable fashion
before going into deeper details.

I want te solve the following task;

- In the _measureUnbrokenSpan loop (Layout-TNG-Compute.cpp) soft-hyphens
are detected. It can nicely break in such situation.
- Currently a soft-hypen is invisible, but clearly the position in the
source stream is know.
- Based on this position I want to *replace* the softhypen in this
rendering run with a '-'
- This might need an a priori knowledge of the '-' width


Could anyone suggest how to append a Span with only a "-" or replace the
soft-hyphen with a hard one in this run?


Thanks in advance,

Stefan de Konink
Stefan de Konink
2008-10-30 20:48:04 UTC
Permalink
Alexandre Prokoudine
2008-10-30 21:31:02 UTC
Permalink
Indeed it never shows the character and/or glyph. It is good news that
no string need to be modified. I'll try to debug it :) Because I
*really* want to get this to work.
That means also, that Inkscape should be able to mark parts of text as
written in a specific language ;-)

Alexandre
Stefan de Konink
2008-10-30 21:45:32 UTC
Permalink
Post by Alexandre Prokoudine
Indeed it never shows the character and/or glyph. It is good news that
no string need to be modified. I'll try to debug it :) Because I
*really* want to get this to work.
That means also, that Inkscape should be able to mark parts of text as
written in a specific language ;-)
No this is the wrong perception :) Inkscape supports annotated text; in
order to hyphenate 'normal' text it you need to have grammar rules like
Babel (TeX) uses or search and replace on a wordlist.


Stefan
Alexandre Prokoudine
2008-10-30 22:08:47 UTC
Permalink
Post by Stefan de Konink
in
order to hyphenate 'normal' text it you need to have grammar rules like
Babel (TeX) uses or search and replace on a wordlist.
Stop reading my mind! :-)))

Alexandre

unknown
1970-01-01 00:00:00 UTC
Permalink
Richard Hughes wrote:
Richard Hughes
2008-10-30 20:41:09 UTC
Permalink
Post by Stefan de Konink
I'm trying to get soft-hyphenation to work in an acceptable fashion
before going into deeper details.
Before I respond to the rest, let me just mention that the code was
written (by me) with the intention that soft hyphens ought to work,
but I never got round to doing any testing (and to my knowledge,
neither has anyone else) so I'm not surprised that it doesn't work.
Post by Stefan de Konink
I want te solve the following task;
- In the _measureUnbrokenSpan loop (Layout-TNG-Compute.cpp) soft-hyphens
are detected. It can nicely break in such situation.
- Currently a soft-hypen is invisible, but clearly the position in the
source stream is know.
- Based on this position I want to *replace* the softhypen in this
rendering run with a '-'
- This might need an a priori knowledge of the '-' width
Could anyone suggest how to append a Span with only a "-" or replace the
soft-hyphen with a hard one in this run?
That's not quite the correct way to do it. If you bring up the
character map application for your OS, you'll notice that U+00AD (the
soft hyphen) has a valid glyph and looks just like a normal hyphen, so
what the code is supposed to do is leave the soft hyphen in place when
it's needed and omit it when it's not. This means that there aren't
any problems with needing to know the width of the character, because
we've already measured it.

So the way it was intended to work was that unbroken spans are
converted into broken spans by _measureUnbrokenSpan (i.e. word
wrapping) which pays attention to soft hyphens. _outputLine then
simply omits soft hyphens unless they're at the end of a broken span.
Omitting, in this case, means that they don't get put into the
Layout::characters_ or Layout::glyphs_ vectors.
bulia byak
2008-10-30 21:50:53 UTC
Permalink
Post by Richard Hughes
Post by Stefan de Konink
I'm trying to get soft-hyphenation to work in an acceptable fashion
before going into deeper details.
Before I respond to the rest, let me just mention that the code was
written (by me) with the intention that soft hyphens ought to work,
but I never got round to doing any testing (and to my knowledge,
neither has anyone else) so I'm not surprised that it doesn't work.
So, once we get this to work, will it be possible to add a "Enable
hyphenation" command or extension which would insert soft hyphens into
a flowed text object, based on language, e.g. using TeX vocabularies?
--
bulia byak
Inkscape. Draw Freely.
http://www.inkscape.org
Stefan de Konink
2008-10-30 21:55:43 UTC
Permalink
Post by bulia byak
Post by Richard Hughes
Post by Stefan de Konink
I'm trying to get soft-hyphenation to work in an acceptable fashion
before going into deeper details.
Before I respond to the rest, let me just mention that the code was
written (by me) with the intention that soft hyphens ought to work,
but I never got round to doing any testing (and to my knowledge,
neither has anyone else) so I'm not surprised that it doesn't work.
So, once we get this to work, will it be possible to add a "Enable
hyphenation" command or extension which would insert soft hyphens into
a flowed text object, based on language, e.g. using TeX vocabularies?
Exactly. But hyphenation is by default a strategy to break up text :)

And... if I understand CSS3 correctly, the language component is part of it.


Stefan
Loading...