You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by tranhsv <tr...@aureole-it.vn> on 2014/10/02 14:06:37 UTC

How to config font in FOP 1.1

Dear the members of Apache Software Foundation !
I have 2 questions  with FOP 1.1. 
1) The first question is about font configuration in FOP .
I'm using FOP 1.1. After I have converted a fo file to pdf by FOP 1.1
library , I have received the following warning messages.

2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "つ" (0x3064, tuhiragana) not available in font "Helvetica".
2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "き" (0x304d, kihiragana) not available in font "Helvetica".
2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "ま" (0x307e, mahiragana) not available in font "Helvetica".
2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "し" (0x3057, sihiragana) not available in font "Helvetica".
2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "て" (0x3066, tehiragana) not available in font "Helvetica".
2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "は" (0x306f, hahiragana) not available in font "Helvetica".
2014-10-02 18:17:20,713 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "、" (0x3001, ideographiccomma) not available in font "Helvetica".
2014-10-02 18:17:20,713 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "下" (0x4e0b) not available in font "Helvetica".

I don't know what's wrong with my fop.xconf ? I have attached my fop.xconf in this email. My program is using IpagStsong font. 
In order to have this font , I have merged multiple font files into a font file.
I want to convert all fonts to my IpagStsong font. Because I only want to use a font file . 
So I need re-map any font-family to IpagStsong font. What should I do in this case?
<?xml version="1.0"?>
<fop version="1.0">
	<renderers>
	 <renderer mime="application/pdf">
			<fonts>
				<font metrics-url="IpagStsong.xml" kerning="yes" embed-url="IpagStsong.ttf">
				    <font-triplet name="IPAGothic" style="normal" weight="normal"/>
					<font-triplet name="IPAGothic" style="normal" weight="bold"/>
				    <font-triplet name="IPAGothic" style="italic" weight="normal"/>
				</font>
				<substitutions>
				      <substitution>
				        <from font-family="*"/>
				        <to font-family="IPAGothic"/>
				      </substitution>
				    </substitutions>
			</fonts>
		 </renderer>
	</renderers>
</fop>


2) In another case , if my configuration such as the following : 
 <?xml version="1.0"?>

<!-- NOTE: This is the version of the configuration -->
<fop version="1.0">
<renderers>
 <renderer mime="application/pdf">
	<fonts>
	<!--<auto-detect/>-->
	<font metrics-url="IpagStsong.xml" kerning="yes" embed-url="IpagStsong.ttf">
	    <font-triplet name="IPAGothic" style="normal" weight="normal"/>
		<font-triplet name="IPAGothic" style="normal" weight="bold"/>
	    <font-triplet name="IPAGothic" style="italic" weight="normal"/>
	    <font-triplet name="sans-serif" style="normal" weight="normal"/>
		<font-triplet name="sans-serif" style="normal" weight="bold"/>
	    <font-triplet name="sans-serif" style="italic" weight="normal"/>
	    <font-triplet name="Helvetica" style="normal" weight="normal"/>
		<font-triplet name="Helvetica" style="normal" weight="bold"/>
	    <font-triplet name="Helvetica" style="italic" weight="normal"/>
	    <font-triplet name="SansSerif" style="normal" weight="normal"/>
		<font-triplet name="SansSerif" style="normal" weight="bold"/>
	    <font-triplet name="SansSerif" style="italic" weight="normal"/>
	    <font-triplet name="Times" style="normal" weight="normal"/>
		<font-triplet name="Times" style="normal" weight="bold"/>
	    <font-triplet name="Times" style="italic" weight="normal"/>
	    <font-triplet name="Times Roman," style="normal" weight="normal"/>
		<font-triplet name="Times Roman," style="normal" weight="bold"/>
	    <font-triplet name="Times Roman," style="italic" weight="normal"/>
	    <font-triplet name="Times-Roman" style="normal" weight="normal"/>
		<font-triplet name="Times-Roman" style="normal" weight="bold"/>
	    <font-triplet name="Times-Roman" style="italic" weight="normal"/>
	    <font-triplet name="serif" style="normal" weight="normal"/>
		<font-triplet name="serif" style="normal" weight="bold"/>
	    <font-triplet name="serif" style="italic" weight="normal"/>
	    <font-triplet name="any" style="normal" weight="normal"/>
		<font-triplet name="any" style="normal" weight="bold"/>
	    <font-triplet name="any" style="italic" weight="normal"/>
	    <font-triplet name="Courier" style="normal" weight="normal"/>
		<font-triplet name="Courier" style="normal" weight="bold"/>
	    <font-triplet name="Courier" style="italic" weight="normal"/>
	    <font-triplet name="monospace" style="normal" weight="normal"/>
		<font-triplet name="monospace" style="normal" weight="bold"/>
	    <font-triplet name="monospace" style="italic" weight="normal"/>
	    <font-triplet name="Monospaced" style="normal" weight="normal"/>
		<font-triplet name="Monospaced" style="normal" weight="bold"/>
	    <font-triplet name="Monospaced" style="italic" weight="normal"/>
	    <font-triplet name="Symbol" style="normal" weight="normal"/>
		<font-triplet name="Symbol" style="normal" weight="bold"/>
	    <font-triplet name="Symbol" style="italic" weight="normal"/>
	</font>
	</fonts>
 </renderer>
</renderers>
</fop>

I won't see the above warning messages . What is the different between substitution and font-triplet ? 


Re: How to config font in FOP 1.1

Posted by Luis Bernardo <lm...@gmail.com>.
Since you only use one font-family in the document and applies to the 
full content of the document you don't need to configure any font 
substitution. Just configure the font you use. Also, don't use the 
metrics-url. Are you running from the command line?

On 10/2/14, 1:06 PM, tranhsv wrote:
> Dear the members of Apache Software Foundation !
> I have 2 questions  with FOP 1.1.
> 1) The first question is about font configuration in FOP .
> I'm using FOP 1.1. After I have converted a fo file to pdf by FOP 1.1
> library , I have received the following warning messages.
>
> 2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "?" (0x3064, tuhiragana) not available in font "Helvetica".
> 2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "?" (0x304d, kihiragana) not available in font "Helvetica".
> 2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "?" (0x307e, mahiragana) not available in font "Helvetica".
> 2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "?" (0x3057, sihiragana) not available in font "Helvetica".
> 2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "?" (0x3066, tehiragana) not available in font "Helvetica".
> 2014-10-02 18:17:20,712 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "?" (0x306f, hahiragana) not available in font "Helvetica".
> 2014-10-02 18:17:20,713 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "?" (0x3001, ideographiccomma) not available in font "Helvetica".
> 2014-10-02 18:17:20,713 WARN  org.apache.fop.apps.FOUserAgent  - Glyph "?" (0x4e0b) not available in font "Helvetica".
>
> I don't know what's wrong with my fop.xconf ? I have attached my fop.xconf in this email. My program is using IpagStsong font.
> In order to have this font , I have merged multiple font files into a font file.
> I want to convert all fonts to my IpagStsong font. Because I only want to use a font file .
> So I need re-map any font-family to IpagStsong font. What should I do in this case?
> <?xml version="1.0"?>
> <fop version="1.0">
> 	<renderers>
> 	 <renderer mime="application/pdf">
> 			<fonts>
> 				<font metrics-url="IpagStsong.xml" kerning="yes" embed-url="IpagStsong.ttf">
> 				    <font-triplet name="IPAGothic" style="normal" weight="normal"/>
> 					<font-triplet name="IPAGothic" style="normal" weight="bold"/>
> 				    <font-triplet name="IPAGothic" style="italic" weight="normal"/>
> 				</font>
> 				<substitutions>
> 				      <substitution>
> 				        <from font-family="*"/>
> 				        <to font-family="IPAGothic"/>
> 				      </substitution>
> 				    </substitutions>
> 			</fonts>
> 		 </renderer>
> 	</renderers>
> </fop>
>
>
> 2) In another case , if my configuration such as the following :
>   <?xml version="1.0"?>
>
> <!-- NOTE: This is the version of the configuration -->
> <fop version="1.0">
> <renderers>
>   <renderer mime="application/pdf">
> 	<fonts>
> 	<!--<auto-detect/>-->
> 	<font metrics-url="IpagStsong.xml" kerning="yes" embed-url="IpagStsong.ttf">
> 	    <font-triplet name="IPAGothic" style="normal" weight="normal"/>
> 		<font-triplet name="IPAGothic" style="normal" weight="bold"/>
> 	    <font-triplet name="IPAGothic" style="italic" weight="normal"/>
> 	    <font-triplet name="sans-serif" style="normal" weight="normal"/>
> 		<font-triplet name="sans-serif" style="normal" weight="bold"/>
> 	    <font-triplet name="sans-serif" style="italic" weight="normal"/>
> 	    <font-triplet name="Helvetica" style="normal" weight="normal"/>
> 		<font-triplet name="Helvetica" style="normal" weight="bold"/>
> 	    <font-triplet name="Helvetica" style="italic" weight="normal"/>
> 	    <font-triplet name="SansSerif" style="normal" weight="normal"/>
> 		<font-triplet name="SansSerif" style="normal" weight="bold"/>
> 	    <font-triplet name="SansSerif" style="italic" weight="normal"/>
> 	    <font-triplet name="Times" style="normal" weight="normal"/>
> 		<font-triplet name="Times" style="normal" weight="bold"/>
> 	    <font-triplet name="Times" style="italic" weight="normal"/>
> 	    <font-triplet name="Times Roman," style="normal" weight="normal"/>
> 		<font-triplet name="Times Roman," style="normal" weight="bold"/>
> 	    <font-triplet name="Times Roman," style="italic" weight="normal"/>
> 	    <font-triplet name="Times-Roman" style="normal" weight="normal"/>
> 		<font-triplet name="Times-Roman" style="normal" weight="bold"/>
> 	    <font-triplet name="Times-Roman" style="italic" weight="normal"/>
> 	    <font-triplet name="serif" style="normal" weight="normal"/>
> 		<font-triplet name="serif" style="normal" weight="bold"/>
> 	    <font-triplet name="serif" style="italic" weight="normal"/>
> 	    <font-triplet name="any" style="normal" weight="normal"/>
> 		<font-triplet name="any" style="normal" weight="bold"/>
> 	    <font-triplet name="any" style="italic" weight="normal"/>
> 	    <font-triplet name="Courier" style="normal" weight="normal"/>
> 		<font-triplet name="Courier" style="normal" weight="bold"/>
> 	    <font-triplet name="Courier" style="italic" weight="normal"/>
> 	    <font-triplet name="monospace" style="normal" weight="normal"/>
> 		<font-triplet name="monospace" style="normal" weight="bold"/>
> 	    <font-triplet name="monospace" style="italic" weight="normal"/>
> 	    <font-triplet name="Monospaced" style="normal" weight="normal"/>
> 		<font-triplet name="Monospaced" style="normal" weight="bold"/>
> 	    <font-triplet name="Monospaced" style="italic" weight="normal"/>
> 	    <font-triplet name="Symbol" style="normal" weight="normal"/>
> 		<font-triplet name="Symbol" style="normal" weight="bold"/>
> 	    <font-triplet name="Symbol" style="italic" weight="normal"/>
> 	</font>
> 	</fonts>
>   </renderer>
> </renderers>
> </fop>
>
> I won't see the above warning messages . What is the different between substitution and font-triplet ?
>
>
> This body part will be downloaded on demand.