开发者

font-family in FOP

开发者 https://www.devze.com 2023-03-03 11:36 出处:网络
I was just wondering, is it possible, to name s开发者_C百科everal alternative fonts in an FO-File?

I was just wondering, is it possible, to name s开发者_C百科everal alternative fonts in an FO-File? I know it's possible in HTML and CSS, but I couldn't find anything about XSL-FO.

Like this:

h1 {
  font-family: arial, verdana, serif;
}

My problem is, that FOP can't use most of my fonts, so it would be great if I could find a possibility to give FOP like 3 font-names and it then tries to use all of them, before using Times New Roman.

Thanks for your help.


It works like CSS (although with FOP, it may not behave exactly the same). XSL-FO’s font-family property is specified as a list of font names, separated by commas, in order from first choice to last choice.

This property specifies a prioritized list of font family names and/or generic family names. To deal with the problem that a single font may not contain glyphs to display all the characters in a document, or that not all fonts are available on all systems, this property allows authors to specify a list of fonts, all of the same style and size, that are tried in sequence to see if they contain a glyph for a certain character. This list is called a font set.

FOP can be configured in a number of ways to load additional fonts. The easiest is to set the auto-detect flag, and FOP will scan your system for installed fonts.

When the "auto-detect" flag is set in the configuration, FOP will automatically search for fonts in the default paths for your operating system.

FOP will also auto-detect fonts which are available in the classpath, if they are described as "application/x-font" in the MANIFEST.MF file. For example, if your .jar file contains font/myfont.ttf:

Manifest-Version: 1.0

      Name: font/myfont.ttf
      Content-Type: application/x-font

This feature allows you to create JAR files containing fonts. The JAR files can be added to fop by providem them in the classpath, e.g. copying them into the lib/ directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消