Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么GraphicsEnvironment';s getAllFonts()返回的字体是否与fc列表中的不同?_Java_Linux_Fonts - Fatal编程技术网

Java 为什么GraphicsEnvironment';s getAllFonts()返回的字体是否与fc列表中的不同?

Java 为什么GraphicsEnvironment';s getAllFonts()返回的字体是否与fc列表中的不同?,java,linux,fonts,Java,Linux,Fonts,为什么GraphicsEnvironment的getAllFonts()方法返回不同的字体 比fc列表(在linux上?) fc列表返回: Abyssinica SIL:style=Regular Cantarell:style=Bold Cantarell:style=Regular Century Schoolbook L:style=Bold Century Schoolbook L:style=Bold Italic Century Schoolbook L:style=Italic C

为什么GraphicsEnvironment的getAllFonts()方法返回不同的字体 比fc列表(在linux上?)

fc列表返回:

Abyssinica SIL:style=Regular
Cantarell:style=Bold
Cantarell:style=Regular
Century Schoolbook L:style=Bold
Century Schoolbook L:style=Bold Italic
Century Schoolbook L:style=Italic
Century Schoolbook L:style=Roman
Courier:style=Regular
DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold
DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold Oblique,Bold Oblique
DejaVu Sans,DejaVu Sans Condensed:style=Condensed,Book
DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique
DejaVu Sans,DejaVu Sans Light:style=ExtraLight
DejaVu Sans Mono:style=Bold
DejaVu Sans Mono:style=Bold Oblique
DejaVu Sans Mono:style=Book
DejaVu Sans Mono:style=Oblique
DejaVu Sans:style=Bold
DejaVu Sans:style=Bold Oblique
DejaVu Sans:style=Book
DejaVu Sans:style=Oblique
DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold,Bold
DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold Italic,Bold Italic
DejaVu Serif,DejaVu Serif Condensed:style=Condensed,Book
DejaVu Serif,DejaVu Serif Condensed:style=Condensed Italic,Italic
DejaVu Serif:style=Bold
DejaVu Serif:style=Bold Italic
DejaVu Serif:style=Book
DejaVu Serif:style=Italic
Dingbats:style=Regular
...
AbyssinicaSIL
CenturySchL-Bold
CenturySchL-BoldItal
CenturySchL-Ital
CenturySchL-Roma
DejaVuSans
DejaVuSans-Bold
DejaVuSans-BoldOblique
DejaVuSansCondensed
DejaVuSansCondensed-Bold
DejaVuSansCondensed-BoldOblique
DejaVuSansCondensed-Oblique
DejaVuSans-ExtraLight
DejaVuSansMono
DejaVuSansMono-Bold
DejaVuSansMono-BoldOblique
DejaVuSansMono-Oblique
DejaVuSans-Oblique
DejaVuSerif
DejaVuSerif-Bold
DejaVuSerif-BoldItalic
DejaVuSerifCondensed
DejaVuSerifCondensed-Bold
DejaVuSerifCondensed-BoldItalic
DejaVuSerifCondensed-Italic
DejaVuSerif-Italic
Dialog.bold
Dialog.bolditalic
Dialog.italic
Dialog.plain
DialogInput.bold
DialogInput.bolditalic
DialogInput.italic
DialogInput.plain
Dingbats
...
鉴于

GraphicsEnvironment中的getAllFonts返回:

Abyssinica SIL:style=Regular
Cantarell:style=Bold
Cantarell:style=Regular
Century Schoolbook L:style=Bold
Century Schoolbook L:style=Bold Italic
Century Schoolbook L:style=Italic
Century Schoolbook L:style=Roman
Courier:style=Regular
DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold
DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold Oblique,Bold Oblique
DejaVu Sans,DejaVu Sans Condensed:style=Condensed,Book
DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique
DejaVu Sans,DejaVu Sans Light:style=ExtraLight
DejaVu Sans Mono:style=Bold
DejaVu Sans Mono:style=Bold Oblique
DejaVu Sans Mono:style=Book
DejaVu Sans Mono:style=Oblique
DejaVu Sans:style=Bold
DejaVu Sans:style=Bold Oblique
DejaVu Sans:style=Book
DejaVu Sans:style=Oblique
DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold,Bold
DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold Italic,Bold Italic
DejaVu Serif,DejaVu Serif Condensed:style=Condensed,Book
DejaVu Serif,DejaVu Serif Condensed:style=Condensed Italic,Italic
DejaVu Serif:style=Bold
DejaVu Serif:style=Bold Italic
DejaVu Serif:style=Book
DejaVu Serif:style=Italic
Dingbats:style=Regular
...
AbyssinicaSIL
CenturySchL-Bold
CenturySchL-BoldItal
CenturySchL-Ital
CenturySchL-Roma
DejaVuSans
DejaVuSans-Bold
DejaVuSans-BoldOblique
DejaVuSansCondensed
DejaVuSansCondensed-Bold
DejaVuSansCondensed-BoldOblique
DejaVuSansCondensed-Oblique
DejaVuSans-ExtraLight
DejaVuSansMono
DejaVuSansMono-Bold
DejaVuSansMono-BoldOblique
DejaVuSansMono-Oblique
DejaVuSans-Oblique
DejaVuSerif
DejaVuSerif-Bold
DejaVuSerif-BoldItalic
DejaVuSerifCondensed
DejaVuSerifCondensed-Bold
DejaVuSerifCondensed-BoldItalic
DejaVuSerifCondensed-Italic
DejaVuSerif-Italic
Dialog.bold
Dialog.bolditalic
Dialog.italic
Dialog.plain
DialogInput.bold
DialogInput.bolditalic
DialogInput.italic
DialogInput.plain
Dingbats
...
比较这两个不同的列表,示教列表的字体对另一个不可用

有人能解释发生了什么事吗


进一步说明:

我首先问这个问题的原因是,我试图找出一些UI问题,其中一个操作系统(例如Solaris)上定义的字体与另一个操作系统(例如Linux)上定义的字体不同

我认为问题在于,虽然两个操作系统都有相同的逻辑字体(对话框), 它们不一定具有相同的物理字体

但是,如果您制作的字体如下:

Font STANDARD_FONT = new Font("Dialog", 0, 12); 
这并不能保证在任何地方都是一样的

我希望可以查看两个系统上可用的字体,并查看通过fc列表可以使用的字体,但是java报告的字体(Dialog.plain)并不是根据fc列表列出的字体

因此,如果我通过新字体(“对话框”,0,12)定义逻辑字体, 通过java提供的API(例如font.getName()等)显示:

postscript-Dialog.plain 家庭对话 名称-对话框 fontName-Dialog.plain 尺码-12


我如何准确地说出java选择用于对话框系列的物理字体?

getAllFonts()
中唯一显示的字体系列不是物理字体,这意味着它们不是计算机上的字体文件,因此
fc list
无法找到它们。它们是每个Java实现中常见的字体系列,并映射到物理字体

逻辑字体是Java平台定义的五种字体系列,任何Java运行时环境都必须支持它们:Serif、SansSerif、Monospaced、Dialog和DialogInput。这些逻辑字体不是实际的字体库。相反,Java运行时环境将逻辑字体名称映射到物理字体

至于
fc list
专用的字体系列,它们很可能是系统上运行的Java实现不支持的物理字体。Java实现需要支持的唯一字体类型是TrueType;
fc list
专用的字体可能不是TrueType

Java平台的所有实现都必须支持TrueType字体;对其他字体技术的支持取决于实现


资料来源:。

感谢瓦肯的澄清。我在上面添加了一些注释,说明了我看到的内容与我看不到的内容,要发现每个逻辑字体对应的内容,您需要阅读。这似乎是一个有点难看的解决方案,因为无法确定它选择的是哪个属性文件。我在JavaAPI指南的基础上做了一个很好的猜测,但是如果有一个api可以打印它选择的物理字体的名称,那就更好了。感谢瓦肯提供的大量信息,非常明确的建议。