delphi – 更改默认TextSettings字体系列/大小(XE7)
发布时间:2020-12-15 09:28:42 所属栏目:大数据 来源:网络整理
导读:我目前正在开发 Windows 8.1和OSX Yosemite的应用程序. Firemonkey使用Segoe UI(12)和Helvetica(13)作为默认字体系列和大小. 有人知道更改这些默认设置或完全取消它们的方法: 由于默认字体具有不同的字体大小(12和13),因此很难获得相同的外观和感觉. 正如你
我目前正在开发
Windows 8.1和OSX Yosemite的应用程序.
Firemonkey使用Segoe UI(12)和Helvetica(13)作为默认字体系列和大小. 有人知道更改这些默认设置或完全取消它们的方法: 由于默认字体具有不同的字体大小(12和13),因此很难获得相同的外观和感觉. 正如你所看到的,除了默认值之外,其他大小看起来都相同. 如果要在OSX中显示文本大小为12的字体,则必须在运行时执行此操作.那是因为如果你在设计器中设置文本大小12,它将自动切换到(默认)并在编译mac时将其更改为13. 解决方法
您可以通过替换IFMXSystemFontService来更改默认字体和大小:
unit My.FontService; interface uses FMX.Platform; type TmyFMXSystemFontService = class(TInterfacedObject,IFMXSystemFontService) public function GetDefaultFontFamilyName: string; function GetDefaultFontSize: Single; end; implementation function TmyFMXSystemFontService.GetDefaultFontFamilyName: string; begin Result := 'Lato'; end; function TmyFMXSystemFontService.GetDefaultFontSize: Single; begin Result := 12; end; procedure InitFont; begin if TPlatformServices.Current.SupportsPlatformService(IFMXSystemFontService) then TPlatformServices.Current.RemovePlatformService(IFMXSystemFontService); TPlatformServices.Current.AddPlatformService(IFMXSystemFontService,TmyFMXSystemFontService.Create); end; initialization InitFont; end. 默认字体大小(在XE10中,不知道XE7)是 >对于Windows:12(请参阅FMX.Platform.Win.pas中的DefaultWindowsFontSize)>对于iOS:14(请参阅FMX.Platform.iOS.pas中的DefaultiOSFontSize)>对于OS X:13(请参阅FMX.Platform.Mac.pas中的DefaultMacFontSize) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |