diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2014-10-21 13:53:20 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2014-10-21 13:53:20 +0100 |
commit | 6d0585a89b86a24e90e74ff96f81da9853d3c35d (patch) | |
tree | 2167167697953a98362669b154ff2eed521446e7 /src/corelib/render/software | |
parent | 6a3d645d0edc18051ec8ac3ad8e6fdb9dc51aa54 (diff) | |
download | fpGUI-6d0585a89b86a24e90e74ff96f81da9853d3c35d.tar.xz |
aggpas: Implements and uses a GetWindowsFontPath function.
AggPas now correctly queries the correct Windows install path.
Thanks Marcus for pointing out my hasty commit from before.
Diffstat (limited to 'src/corelib/render/software')
-rw-r--r-- | src/corelib/render/software/Agg2D.pas | 5 | ||||
-rw-r--r-- | src/corelib/render/software/agg_platform_gdi.inc | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas index 8809bcd8..333e37ea 100644 --- a/src/corelib/render/software/Agg2D.pas +++ b/src/corelib/render/software/Agg2D.pas @@ -3559,10 +3559,7 @@ procedure TAgg2D.DoSetFontRes(fntres: TfpgFontResourceBase); {$IFDEF WINDOWS} begin {$IFDEF AGG2D_USE_FREETYPE } - if DirectoryExists('c:\WINNT\Fonts') then - Font('c:\WINNT\Fonts\arial.ttf', 10) - else - Font('c:\Windows\Fonts\arial.ttf', 10); + Font(GetWindowsFontDir + 'arial.ttf', 10); {$ENDIF } {$IFDEF AGG2D_USE_WINFONTS} Font('Arial', 13); diff --git a/src/corelib/render/software/agg_platform_gdi.inc b/src/corelib/render/software/agg_platform_gdi.inc index 88d3b586..c61d068f 100644 --- a/src/corelib/render/software/agg_platform_gdi.inc +++ b/src/corelib/render/software/agg_platform_gdi.inc @@ -21,6 +21,19 @@ type // to get access to protected methods (seeing that FPC doesn't support Friend-classes) TImageHack = class(TfpgImage); +function GetWindowsFontDir: string; +var + lWinFontPath: array[0..MAX_PATH] of WideChar; + lPasWinFontPath: string; + i: Integer; +begin + // Find for example C:\Windows\Fonts or C:\WINNT\Fonts + Windows.GetWindowsDirectoryW(@lWinFontPath[0], MAX_PATH); + lPasWinFontPath := lWinFontPath; + lPasWinFontPath := IncludeTrailingPathDelimiter(lPasWinFontPath) + 'Fonts' + PathDelim; + Result := lPasWinFontPath; +end; + procedure TAgg2D.DoPutBufferToScreen(x, y, w, h: TfpgCoord); var srcdc: HDC; |