Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to export PDF with chinese fonts #512

Closed
tbs575 opened this issue Apr 20, 2021 · 9 comments
Closed

How to export PDF with chinese fonts #512

tbs575 opened this issue Apr 20, 2021 · 9 comments

Comments

@tbs575
Copy link

tbs575 commented Apr 20, 2021

I using asciidocFX v1.7.3 on windows 7, can not export PDF with chinese character. chinese character became #### in PDF.

@rahmanusta
Copy link
Member

Hi, probably to setup correct fonts for chinese characters. You can see font selections in https://github.com/asciidocfx/AsciidocFX/blob/master/conf/docbook-config/fo-pdf.xsl . You may need to change your local fo-pdf.xsl.

@tbs575
Copy link
Author

tbs575 commented Apr 21, 2021

thanks, fixed

@tbs575 tbs575 closed this as completed Apr 21, 2021
@tbs575 tbs575 reopened this Apr 21, 2021
@tbs575
Copy link
Author

tbs575 commented Apr 21, 2021

@rahmanusta Hi, as URL add chinese fonts, export PDF OK, but met new issue. Level 3 Section Title chinese can not export correctly. see pic.

modified fo-pdf.xsl

<xsl:template name="pickfont-sans">
    <xsl:text>SimHei,Sans-serif,Arial,Arial Unicode MS,Helvetica,serif,Georgia,Times New Roman</xsl:text>
</xsl:template>

<xsl:template name="pickfont-serif">
    <xsl:text>SimHei,Sans-serif,Arial,Arial Unicode MS,Helvetica,serif,Georgia,Times New Roman</xsl:text>
</xsl:template>

<xsl:template name="pickfont-mono">
    <xsl:text>SimHei,Liberation Mono,Lucida Console,Monaco,Consolas,Courier New,Courier,monospace,Arial Unicode MS,Lucida Sans Unicode</xsl:text>
</xsl:template>

<xsl:template name="pickfont-dingbat">
    <xsl:call-template name="pickfont-sans"/>
</xsl:template>

<xsl:template name="pickfont-symbol">
    <xsl:text>SimHei,Symbol,ZapfDingbats</xsl:text>
</xsl:template>

<xsl:template name="pickfont-math">
    <xsl:text>Liberation Serif,Sans-serif,serif,Times-Roman</xsl:text>
</xsl:template>

in editor is right.
image

but error in export PDF
image

@rahmanusta
Copy link
Member

You can find the solution here #287

Index: conf/docbook-config/fo-pdf.xsl
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/conf/docbook-config/fo-pdf.xsl b/conf/docbook-config/fo-pdf.xsl
--- a/conf/docbook-config/fo-pdf.xsl	(revision 07679a892bde5098e7a9b0e94fe832a1456c5846)
+++ b/conf/docbook-config/fo-pdf.xsl	(date 1618985193766)
@@ -854,37 +854,26 @@
 
     <xsl:attribute-set name="section.title.level1.properties">
         <xsl:attribute name="font-size">12pt</xsl:attribute>
-        <xsl:attribute name="font-weight">bold</xsl:attribute>
     </xsl:attribute-set>
 
     <xsl:attribute-set name="section.title.level2.properties">
         <xsl:attribute name="font-size">12pt</xsl:attribute>
-        <xsl:attribute name="font-style">italic</xsl:attribute>
-        <xsl:attribute name="font-weight">bold</xsl:attribute>
     </xsl:attribute-set>
 
     <xsl:attribute-set name="section.title.level3.properties">
         <xsl:attribute name="font-size">12pt</xsl:attribute>
-        <xsl:attribute name="font-style">italic</xsl:attribute>
-        <xsl:attribute name="font-weight">bold</xsl:attribute>
     </xsl:attribute-set>
 
     <xsl:attribute-set name="section.title.level4.properties">
         <xsl:attribute name="font-size">12pt</xsl:attribute>
-        <xsl:attribute name="font-style">italic</xsl:attribute>
-        <xsl:attribute name="font-weight">bold</xsl:attribute>
     </xsl:attribute-set>
 
     <xsl:attribute-set name="section.title.level5.properties">
         <xsl:attribute name="font-size">12pt</xsl:attribute>
-        <xsl:attribute name="font-style">italic</xsl:attribute>
-        <xsl:attribute name="font-weight">bold</xsl:attribute>
     </xsl:attribute-set>
 
     <xsl:attribute-set name="section.title.level6.properties">
         <xsl:attribute name="font-size">12pt</xsl:attribute>
-        <xsl:attribute name="font-style">italic</xsl:attribute>
-        <xsl:attribute name="font-weight">bold</xsl:attribute>
     </xsl:attribute-set>
 
     <xsl:attribute-set name="component.title.properties">

@tbs575
Copy link
Author

tbs575 commented Apr 21, 2021

@rahmanusta
thanks your help, but still issue. please see pic. more '#' (red mark), why?
image

@rahmanusta
Copy link
Member

Hmm, can you please send the letters? I don't know how to type such :)

@tbs575
Copy link
Author

tbs575 commented Apr 21, 2021

@rahmanusta

= 第一级

== 第二级

=== 第三级

==== 第四级

@rahmanusta
Copy link
Member

I don't have this,

do you have there some hidden character ? Could you please share your asciidoc file ?

image

@tbs575
Copy link
Author

tbs575 commented Apr 21, 2021

@rahmanusta thanks your help, I change chineses font, Using 'Microsoft YaHei', issue gone. I am not sure that is font files issue or more configure with fo-pdf.xsl

@tbs575 tbs575 closed this as completed Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants