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