From 9aa37ba20fa115b2048dfc4280b22acb1580dc56 Mon Sep 17 00:00:00 2001 From: macpgmr Date: Tue, 11 Jan 2011 22:19:22 +0000 Subject: [PATCH] Support for Mac font substitutions in form files. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1435 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/xdev_toolkit/dfmtolfm.ini | 16 ++++++++++------ components/xdev_toolkit/dfmtolfm.pas | 10 ++++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/components/xdev_toolkit/dfmtolfm.ini b/components/xdev_toolkit/dfmtolfm.ini index dfbb0c086..d11c41188 100644 --- a/components/xdev_toolkit/dfmtolfm.ini +++ b/components/xdev_toolkit/dfmtolfm.ini @@ -133,16 +133,20 @@ THTMLViewer= ; http://dustinbrewer.com/popular-fonts-with-their-mac-osx-windows-and-linux-equivalents/ ; http://mondaybynoon.com/2007/04/02/linux-font-equivalents-to-popular-web-typefaces/ -; Note that if you're targeting a specific platform, you can use this to -; substitute normal fonts for that platform, for example if targeting Mac: -; Arial=Lucida Grande - [FontSubstitutes] MS Sans Serif=Arial MS Serif=Times New Roman System=Arial +; With both the -s and -m switches, substitute these fonts first +; before any fonts listed under [FontSubstitutes]. + +[MacFontSubstitutes] +Arial=Lucida Grande +;Arial=Helvetica + + ; These controls cannot receive focus on Mac, so with -m switch ; add TabStop = False so tabbing skips over them. @@ -152,5 +156,5 @@ TBitBtn= TComboBox= TCheckBox= TRadioGroup= -;TListBox= - +TListBox= +TPageControl= diff --git a/components/xdev_toolkit/dfmtolfm.pas b/components/xdev_toolkit/dfmtolfm.pas index c6bf564c7..8a8945352 100644 --- a/components/xdev_toolkit/dfmtolfm.pas +++ b/components/xdev_toolkit/dfmtolfm.pas @@ -310,10 +310,16 @@ begin begin StripStr := Copy(InStr, Pos('=', InStr)+3, MaxInt); {Name after quote} Delete(StripStr, Length(StripStr), 1); {Delete closing quote} - if CfgFileObj.ValueExists('FontSubstitutes', StripStr) then + if MacSwitch and + CfgFileObj.ValueExists('MacFontSubstitutes', StripStr) then WriteLn(LfmFileVar, Copy(InStr, 1, Succ(Pos('=', InStr))), '''', - CfgFileObj.ReadString('FontSubstitutes', StripStr, 'Arial'), + CfgFileObj.ReadString('MacFontSubstitutes', StripStr, ''), + '''') + else if CfgFileObj.ValueExists('FontSubstitutes', StripStr) then + WriteLn(LfmFileVar, + Copy(InStr, 1, Succ(Pos('=', InStr))), '''', + CfgFileObj.ReadString('FontSubstitutes', StripStr, ''), '''') else WriteLn(LfmFileVar, InStr);