You are not logged in.
Hi ab,
Problem detected at...
function TPdfDocument.GetTrueTypeFontIndex(const AName: RawUtf8): integer;
begin
if StrIEqual(pointer(fTrueTypeFontLastName), pointer(AName)) thenStrIEqual with inital empty "fTrueTypeFontLastName" result in true.
Is there a bug in StrIEqual?
if Str1 <> Str2 then
if Str1 <> nil then
if Str2 <> nil then
begin
....
end;
result := true;so the font-index stays at 0 and first system font is used.
Offline
Claude said there is a bug ;-), so also StrIEqualW is affected.
One of the suggested fixes:
if Str1 = Str2 then
begin
result := true;
exit;
end;
if (Str1 = nil) or (Str2 = nil) then
begin
result := false;
exit;
end;
...Offline
Please try with
https://github.com/synopse/mORMot2/commit/958eb4441
Offline
That was realy fast - thanks Arnaud!
Yes, that fixes the problem thanks. Maybe also add the claude suggested tests.
StrIEqual(nil, nil) // true
StrIEqual(nil, 'test') // false
StrIEqual('test', nil) // false
StrIEqual('Test', 'test') // true
StrIEqual('abc', 'xyz') // falseHave a nice evening.
Offline