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.
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. From your description, it sounds like the logic I described in the last two sentences isn't working and it's always omitting the character and/or glyph.
Please continue to ask questions if any of this e-mail didn't make any sense. There are two debugging features in the layout code: I expect you've already found the IFTRACE debug macro at the top of Layout-TNG-Compute.cpp, but there's also the Layout::dumpAsText() function which is called in a commented-out line at sp-flowtext.cpp:509 (and others in sp-text.cpp, either before or after the text is fitted onto a path).
Richard.