ChemText: Fix handling of UTF8 code points with new parameter symbols '^' and '|'

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7979 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-03-13 10:47:26 +00:00
parent 3646a8dd75
commit bca8960049

View File

@ -133,7 +133,7 @@ implementation
{$R chemtext.res} {$R chemtext.res}
uses uses
Themes, Math; Themes, Math, LazUtf8;
type type
TArrowDir = (adLeft, adRight, adBoth); TArrowDir = (adLeft, adRight, adBoth);
@ -251,7 +251,7 @@ var
var var
x0: Integer; x0: Integer;
i, j: integer; i, j, n: integer;
s: string; s: string;
subNos: boolean; // "subscript numbers" subNos: boolean; // "subscript numbers"
escaping: Boolean; escaping: Boolean;
@ -349,14 +349,16 @@ begin
SUPERSCRIPT_CHAR: SUPERSCRIPT_CHAR:
begin begin
inc(i); n := UTF8CodePointSize(@AText[i+1]);
DrawSup(X, Y, AText[i]); DrawSup(X, Y, copy(AText, i+1, n));
inc(i, n);
end; end;
SUBSCRIPT_CHAR: SUBSCRIPT_CHAR:
begin begin
inc(i); n := UTF8CodePointSize(@AText[i+1]);
DrawSub(X, Y, AText[i]); DrawSub(X, Y, copy(AText, i+1, n));
inc(i, n);
end; end;
else else