You are not logged in.
Pages: 1
Hello
I recently had to make changes in the SynPDF library to add some features that my project required but that were not available. Here they are:
- Support for multiple font linking, thus a valid font may be found in case the text contains many languages and both main font and first linked font did not support the language (e.g. FontFallBackNames := 'Arial,Verdana')
- Added a KerningHHorzScale property in TPdfDocumentGDI to be able to change the global Kerning horizontal scale value (in my case was useful to catch up some conversion errors between the GDI canvas and the PDF meta file)
- Added a UNISCRIBE_DYNAMIC_LINK define in case Uniscribe should be linked dynamically to the target application
I think (and hope) that these changes can serve to others, so I published them here: https://drive.google.com/file/d/0B7C-Rw … sp=sharing
Regards
Offline
Hi jeanmilost,
I use your FontFallBackNames feature in SynPDF.pas and I think I have found a little problem.
In TPdfCanvas.SetFont() function You have changed original code to look for a default font in FontFallBackIndexes but I think You have inverted the boolean test.
for i := 0 to count - 1 do begin
FontIndex := FDoc.fFontFallBackIndexes[i];
{$IFDEF TMW_TEST_NEW_FONT_FALLBACK}
if FontIndex >= 0 then // this way better
{$ELSE}
if FontIndex < 0 then // ??
{$ENDIF}
break;
end;
Can you confirm this?
Thank you
Last edited by MtwStark (2019-11-20 16:46:08)
Offline
Hi jeanmilost,
about your function TPdfDocument.GetFontFallBackNames
I have added a check for validity of the font index to avoid AV in case of mispelled or not installed font.
function TPdfDocument.GetFontFallBackNames: string;
var
i, count: Integer;
begin
Result := '';
// get font fallback count
count := Length(fFontFallBackIndexes);
// no font fallback defined?
if (count = 0) then
Exit;
for i := 0 to count - 1 do begin
// first font?
if (i > 0) then
// add separator
Result := Result + ',';
// add next font
{$IFDEF TMW_TEST_NEW_FONT_FALLBACK}
if fFontFallBackIndexes[i] < 0 then // ------------------------------->>> avoid AV if font name was not found ;)
Continue;
{$ENDIF}
Result := Result + UTF8ToString(FTrueTypeFonts[fFontFallBackIndexes[i]]);
end;
end;
Thank you for sharing your work
Offline
Pages: 1