delphi – 为什么精简字体在FireMonkey中无法正确显示?

前端之家收集整理的这篇文章主要介绍了delphi – 为什么精简字体在FireMonkey中无法正确显示?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
(我该怎么办呢?)

如果我在VCL中创建两个标签并设置一个使用Arial和另一个Arial Narrow,我会看到预期的结果.

如果我在Firemonkey中执行相同操作,则第二个标签不会显示在Arial Narrow中.它甚至没有在Arial中显示(我的圆点是圆的,’s’的形状都是错的等等).

有谁知道为什么FM(我用Delphi XE4进行测试)没有正确显示字体?我能做些什么吗?

VCL表格的来源:

object Form3: TForm3
  Left = 0
  Top = 0
  Caption = 'Form3'
  ClientHeight = 198
  ClientWidth = 475
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 24
    Top = 32
    Width = 134
    Height = 14
    Caption = 'This label is using Arial @11'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Arial'
    Font.Style = []
    ParentFont = False
  end
  object Label2: TLabel
    Left = 24
    Top = 52
    Width = 152
    Height = 15
    Caption = 'This label is using Arial Narrow @11'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Arial Narrow'
    Font.Style = []
    ParentFont = False
  end
  object Label3: TLabel
    Left = 24
    Top = 98
    Width = 398
    Height = 36
    Caption = 'This label is using Arial @32'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -32
    Font.Name = 'Arial'
    Font.Style = []
    ParentFont = False
  end
  object Label4: TLabel
    Left = 24
    Top = 140
    Width = 429
    Height = 37
    Caption = 'This label is using Arial Narrow @32'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -32
    Font.Name = 'Arial Narrow'
    Font.Style = []
    ParentFont = False
  end
end

FM表格的来源:

object Form4: TForm4
  Left = 0
  Top = 0
  Caption = 'Form4'
  ClientHeight = 207
  ClientWidth = 558
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [dkDesktop,dkiPhone,dkiPad]
  DesignerMobile = False
  DesignerWidth = 0
  DesignerHeight = 0
  DesignerDeviceName = ''
  DesignerOrientation = 0
  object Label1: TLabel
    Font.Family = 'Arial'
    StyledSettings = [ssSize,ssStyle,ssFontColor]
    Height = 17.000000000000000000
    Position.X = 16.000000000000000000
    Position.Y = 32.000000000000000000
    Text = 'This label is using Arial @11'
    Width = 225.000000000000000000
  end
  object Label2: TLabel
    Font.Family = 'Arial Narrow'
    StyledSettings = [ssSize,ssFontColor]
    Height = 17.000000000000000000
    Position.X = 16.000000000000000000
    Position.Y = 48.000000000000000000
    Text = 'This label is using Arial Narrow @11'
    Width = 225.000000000000000000
  end
  object Label3: TLabel
    Font.Family = 'Arial'
    Font.Size = 32.000000000000000000
    StyledSettings = [ssStyle,ssFontColor]
    Height = 41.000000000000000000
    Position.X = 16.000000000000000000
    Position.Y = 104.000000000000000000
    Text = 'This label is using Arial @32'
    Width = 433.000000000000000000
  end
  object Label4: TLabel
    Font.Family = 'Arial Narrow'
    Font.Size = 32.000000000000000000
    StyledSettings = [ssStyle,ssFontColor]
    Height = 65.000000000000000000
    Position.X = 16.000000000000000000
    Position.Y = 128.000000000000000000
    Text = 'This label is using Arial Narrow @32'
    Width = 545.000000000000000000
  end
end

解决方法

这似乎只影响系列中的字体 – 如果字体文件夹中不存在其自己的系列名称下的字体.例如,Arial Narrow是“Arial”字体文件中的一种字体(它存在于一个系列中,本身并不是一个系列).

通常,字体系列仅包括四种样式

Arial(天真地包含)

> Arial Regular
> Arial Bold
> Arial斜体
> Arial Bold Italic

然而,“Arial Narrow”存在于“Arial”系列中,与标准风格一致 – 即:

Arial(实际上包含)

> Arial Regular
> Arial Bold
> Arial斜体
> Arial Bold Italic
> Arial Narrow
> Arial Narrow Bold
> Arial Narrow Italic
> Arial Narrow Bold Italic
> Arial Black

似乎FMX只在任何给定的字体系列中看起来只有一层,并且没有看到任何偏离严格的GDI样式定义(Regular,Bold,Italic,Bold Italic)的样式变体.

这也通过检查影响Arial Black – 通过运行fonts文件夹很容易找到其他示例. Franklin Gothic Demi,Gill Sans Ultra Bold等……任何遵循上述模式的东西.遇到这些字体时,字体似乎在默认的Segoe UI中呈现.

权宜之计解决方案是使用Arial并将Scale属性设置为X = 0.82 – 它并不完美,但它与Arial Narrow非常接近.

这可能是一个错误,应该是QC’d.

猜你在找的Delphi相关文章