当前位置: 首页 > 知识库问答 >
问题:

JavaFX对所有控件使用单间距字体

丌官绍元
2023-03-14
/usr/share/fonts/liberation
/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf
/usr/share/fonts/liberation/fonts.dir
/usr/share/fonts/liberation/LiberationMono-Italic.ttf
/usr/share/fonts/liberation/LiberationSans-Bold.ttf
/usr/share/fonts/liberation/LiberationSerif-Bold.ttf
/usr/share/fonts/liberation/LiberationMono-Regular.ttf
/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
/usr/share/fonts/liberation/LiberationSerif-BoldItalic.ttf
/usr/share/fonts/liberation/fonts.scale
/usr/share/fonts/liberation/LiberationSans-Regular.ttf
/usr/share/fonts/liberation/LiberationSans-Italic.ttf
/usr/share/fonts/liberation/LiberationMono-Bold.ttf
Loading FontFactory com.sun.javafx.font.freetype.FTFactory
Subpixel: enabled
Freetype2 Loaded (version 2.3.11)
LCD support Enabled
Time spent accessing fontconfig=4ms.
FC font sans:regular:roman maps to Liberation Mono in file /usr/share/fonts/liberation/LiberationMono-Regular.ttf
 0) Family=Liberation Mono, Style=Regular, Fullname=Liberation Mono, File=/usr/share/fonts/liberation/LiberationMono-Regular.ttf
 1) Family=Liberation Sans, Style=Regular, Fullname=Liberation Sans, File=/usr/share/fonts/liberation/LiberationSans-Regular.ttf
 2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font sans:bold:roman maps to Liberation Mono Bold in file /usr/share/fonts/liberation/LiberationMono-Bold.ttf
 0) Family=Liberation Mono, Style=Bold, Fullname=Liberation Mono Bold, File=/usr/share/fonts/liberation/LiberationMono-Bold.ttf
 1) Family=Liberation Sans, Style=Bold, Fullname=Liberation Sans Bold, File=/usr/share/fonts/liberation/LiberationSans-Bold.ttf
 2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font sans:regular:italic maps to Liberation Mono Italic in file /usr/share/fonts/liberation/LiberationMono-Italic.ttf
 0) Family=Liberation Mono, Style=Italic, Fullname=Liberation Mono Italic, File=/usr/share/fonts/liberation/LiberationMono-Italic.ttf
 1) Family=Liberation Sans, Style=Italic, Fullname=Liberation Sans Italic, File=/usr/share/fonts/liberation/LiberationSans-Italic.ttf
 2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font sans:bold:italic maps to Liberation Sans Bold Italic in file /usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
 0) Family=Liberation Sans, Style=Bold Italic, Fullname=Liberation Sans Bold Italic, File=/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
 1) Family=Liberation Mono, Style=Bold Italic, Fullname=Liberation Mono Bold Italic, File=/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf
 2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font serif:regular:roman maps to Liberation Mono in file /usr/share/fonts/liberation/LiberationMono-Regular.ttf
 0) Family=Liberation Mono, Style=Regular, Fullname=Liberation Mono, File=/usr/share/fonts/liberation/LiberationMono-Regular.ttf
 1) Family=Liberation Sans, Style=Regular, Fullname=Liberation Sans, File=/usr/share/fonts/liberation/LiberationSans-Regular.ttf
 2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font serif:bold:roman maps to Liberation Mono Bold in file /usr/share/fonts/liberation/LiberationMono-Bold.ttf
 0) Family=Liberation Mono, Style=Bold, Fullname=Liberation Mono Bold, File=/usr/share/fonts/liberation/LiberationMono-Bold.ttf
 1) Family=Liberation Sans, Style=Bold, Fullname=Liberation Sans Bold, File=/usr/share/fonts/liberation/LiberationSans-Bold.ttf
 2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font serif:regular:italic maps to Liberation Mono Italic in file /usr/share/fonts/liberation/LiberationMono-Italic.ttf
 0) Family=Liberation Mono, Style=Italic, Fullname=Liberation Mono Italic, File=/usr/share/fonts/liberation/LiberationMono-Italic.ttf
 1) Family=Liberation Sans, Style=Italic, Fullname=Liberation Sans Italic, File=/usr/share/fonts/liberation/LiberationSans-Italic.ttf
 2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font serif:bold:italic maps to Liberation Sans Bold Italic in file /usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
 0) Family=Liberation Sans, Style=Bold Italic, Fullname=Liberation Sans Bold Italic, File=/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
 1) Family=Liberation Mono, Style=Bold Italic, Fullname=Liberation Mono Bold Italic, File=/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf
 2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font monospace:regular:roman maps to Liberation Mono in file /usr/share/fonts/liberation/LiberationMono-Regular.ttf
 0) Family=Liberation Mono, Style=Regular, Fullname=Liberation Mono, File=/usr/share/fonts/liberation/LiberationMono-Regular.ttf
 1) Family=Liberation Sans, Style=Regular, Fullname=Liberation Sans, File=/usr/share/fonts/liberation/LiberationSans-Regular.ttf
 2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font monospace:bold:roman maps to Liberation Mono Bold in file /usr/share/fonts/liberation/LiberationMono-Bold.ttf
 0) Family=Liberation Mono, Style=Bold, Fullname=Liberation Mono Bold, File=/usr/share/fonts/liberation/LiberationMono-Bold.ttf
 1) Family=Liberation Sans, Style=Bold, Fullname=Liberation Sans Bold, File=/usr/share/fonts/liberation/LiberationSans-Bold.ttf
 2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font monospace:regular:italic maps to Liberation Mono Italic in file /usr/share/fonts/liberation/LiberationMono-Italic.ttf
 0) Family=Liberation Mono, Style=Italic, Fullname=Liberation Mono Italic, File=/usr/share/fonts/liberation/LiberationMono-Italic.ttf
 1) Family=Liberation Sans, Style=Italic, Fullname=Liberation Sans Italic, File=/usr/share/fonts/liberation/LiberationSans-Italic.ttf
 2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font monospace:bold:italic maps to Liberation Sans Bold Italic in file /usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
 0) Family=Liberation Sans, Style=Bold Italic, Fullname=Liberation Sans Bold Italic, File=/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
 1) Family=Liberation Mono, Style=Bold Italic, Fullname=Liberation Mono Bold Italic, File=/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf
 2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC name=sans style=0 uses Liberation Mono in file: /usr/share/fonts/liberation/LiberationMono-Regular.ttf
    null
  • 从我在javafx开发人员邮件列表上发布的问题来看,javafx只使用包装器fc-match,因此问题一定是在字体配置文件中,这在其他地方都可以看到:字体问题,用于衬线和无衬线家族的monospace

共有1个答案

弓智明
2023-03-14

问题似乎出现在/etc/fonts/conf.d/中的fontconfig规则中,而不是JavaFX。我还不能解决这个问题,但是使用fc-match会产生相同的结果

fc-match sans:regular:roman 
"LiberationMono-Regular.ttf": "Liberation Mono" "Regular"

我在另一个论坛上发现了类似的问题:字体问题,monospace用于衬线和无衬线家族,但没有解决方案。

添加字体配置文件,例如/etc/fonts/conf.d/88-libertion-hack.conf可以解决这个问题

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

<alias>
  <family>sans-serif</family>
  <prefer><family>Liberation Sans</family></prefer>
</alias>

<alias>
  <family>serif</family>
  <prefer><family>Liberation Serif</family></prefer>
</alias>


<alias>
  <family>monospace</family>
  <prefer><family>Liberation Mono</family></prefer>
</alias>

</fontconfig>
 类似资料:
  • 我在一个列表中有8个点,我需要计算所有可能对之间的欧几里德距离。我可以编写一个for循环并继续计算距离,但是python/numpy/others有更好的方法吗? 坐标点:

  • 我想创建一个可滚动的时间线控制器,其中圆圈连接到填充有数字(圆的大小对应于包含数字)和尾随图标的基线。 因为我是JavaFX的新手,所以我不知道如何开始。在中,我将例如使用并使用其方法来绘制圆形、线条和图标... 在JavaFX中,我考虑过使用水平的和定制的,但我不确定它是否可以作为基线。所以我在寻找如何实现这种控制的想法。。。

  • 我有一个和一个,在hBox中有三个,一个包含文本,另一个包含表中两列的总和。我想为HBox设置一个动态的间距,使两个标签正好在它们所属的表中的两列下方对齐。是否有可能将的间距绑定到列的位置。我也接受任何其他将标签固定在相应列下方的解决方案。下面是一个显示我想要的图像:

  • 问题内容: 我正在尝试创建一个表格,其中每个单元格具有背景颜色,并且它们之间具有空白。但我似乎在执行此操作时遇到了麻烦。 我尝试设置边距,但似乎没有效果。 如果我对填充执行相同的操作,则可以,但是在单元格之间没有间距。 有人可以帮我吗? 问题答案: 使用元素上的属性设置单元格之间的间距。 确保设置为(否则每个单元格之间将有一个单独的边框,而不是每个单元格之间可能会有间隔的单独边框)。

  • word-spacing属性用来增加或减少单词之间的距离,默认值为0。该属性接受一个正的长度值或负的长度值;设置一个正的长度值时,单词之间的间隔会增加;设置一个负的长度值时,单词之间的间隔会减少,让单词挤得更紧,甚至出现重叠。 因为该属性把由空白符包围的一个字符串看作一个单词,而汉字之间没有空格,所以该属性对中文无效。但是,如果在汉字中人为添加空格,则会把空格前后的汉字按单词处理,该属性会生效。

  • 问题内容: 我遇到了这个问题,我需要使用户易于阅读文本,因此我使用了1 px的字母间距,但看起来很难看,所以我想我将使用0.5 px的半像素,但是不起作用,我尝试使用em属性,但未完成任务。 因此,有一种方法可以使字母间距减半像素(如果可能,请跨浏览器解决方案) 问题答案: 该错误已在2008年报告并得到确认。因此,如果有人觉得要入侵Webkit,会让很多设计师感到高兴。