delphi – 更改默认TextSettings字体系列大小(XE7)

delphi – 更改默认TextSettings字体系列大小(XE7),第1张

概述我目前正在开发 Windows 8.1和OSX Yosemite的应用程序. Firemonkey使用Segoe UI(12)和Helvetica(13)作为默认字体系列和大小. 有人知道更改这些默认设置或完全取消它们的方法: 由于默认字体具有不同的字体大小(12和13),因此很难获得相同的外观和感觉. 正如你所看到的,除了默认值之外,其他大小看起来都相同. 如果要在OSX中显示文本大小为12的字 我目前正在开发 Windows 8.1和OSX Yosemite的应用程序.

Firemonkey使用Segoe UI(12)和Helvetica(13)作为默认字体系列和大小.

有人知道更改这些默认设置或完全取消它们的方法:

由于默认字体具有不同的字体大小(12和13),因此很难获得相同的外观和感觉.

正如你所看到的,除了默认值之外,其他大小看起来都相同.

如果要在OSX中显示文本大小为12的字体,则必须在运行时执行此 *** 作.那是因为如果你在设计器中设置文本大小12,它将自动切换到(默认)并在编译mac时将其更改为13.

解决方法 您可以通过替换IFMXSystemFontService来更改默认字体和大小:

unit My.FontService;interfaceuses  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;initializationInitFont;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)

总结

以上是内存溢出为你收集整理的delphi – 更改默认TextSettings字体系列/大小(XE7)全部内容,希望文章能够帮你解决delphi – 更改默认TextSettings字体系列/大小(XE7)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1261289.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-08
下一篇2022-06-08

发表评论

登录后才能评论

评论列表(0条)

    保存