Bug #96
Updated by J. Templ over 9 years ago
Rendering I had tied to optimize output of Cyrillic text with Unicode characters, for example Cyrillic texts, is slow and of poor quality. The reason is found that in TextSetters.GatherString Cyrillic all the texts go to HostFonts.StringWidth letter by letter. This makes the output slow and other non-ASCII characters are treated as one string per character. By adding a rule for Strings.IsAlpha() it would be possible not accurate. During the text output the GatherString procedure extensively used to produce longer strings split the lines to words. So I am thinking that contain arbitrary it is the location of problem. <pre> PROCEDURE GatherString (rd: StdReader); VAR i, len: INTEGER; ch: CHAR; BEGIN i := 1; len := LEN(rd.string) - 1; ch := rd.r.char; WHILE (i < len) & (rd.r.view = NIL) & (rd.r.attr = rd.attr) & ( (" " < ch) & (ch <= "~") & (ch # "-") OR (ch = digitspace) OR (ch >= nbspace) & (ch < 100X) & (ch # softhyphen) ) DO (* rd.r.char > " " => ~rd.eot *) rd.string[i] := ch; INC(i); rd.eot := rd.r.eot; rd.r.Read; ch := rd.r.char; INC(rd.pos) END; rd.string[i] := 0X; rd.setterOpts := {wordJoin}; IF i = 1 THEN IF WordPart(rd.string[0], 0X) THEN INCL(rd.setterOpts, wordPart) END END; rd.w := rd.attr.font.StringWidth(rd.string); rd.endW := rd.w END GatherString; </pre> You can see here, that any Unicode characters. letter will raise the "exception" call (IF i = 1 THEN). Reported by Ivan Denisov, 2016-01-18. Oleg N. Cher had found, that replacing the "~" to 0FFFFX <pre> & ( (" " < ch) & (ch <= 0FFFFX) & (ch # "-") </pre> led words come to HostFonts.StringWidth, however this is temporary solution. The WordPart procedure should check for such case, but somehow algorithm is broken now.