AsciidocFX編輯器小貼士


I. AsciidocFX支持UML生成:

要生成UML,記得要下載GRAPHVIZ,並配置GRAPHVIZ_DOT環境變量,路徑是Graphviz\bin\dot.exe。

 

II. AsciidocFX生成中文PDF文件時,可能會出現如下兩個問題:

1.頁眉中的中文解析成###,無法正確解析。原因:沒有配置合適的Unicode字體。

2.二級以下的標題無法正確解析中文,中文全部變成###。原因:中文字體無法同時支持 加粗+斜體 的樣式。

 

AsciidocFX使用了FOP來生成pdf,而FOP對中文的支持並不十分完善,引用 http://www.blogjava.net/scud/ 中的描述如下:

FOP 0.20.5功能相對還是比較弱,例如 

1.不支持多種字體的組合,也就是不支持font-family="sans-serif,宋體"這種方式,
   結果就是每段都要指定,否則就只能用一種了,對於confluence來說就很不好了...
   
  2.不支持程序處理斜體,黑體,這樣就要求字體支持黑體,斜體才能實現黑體斜體的效果.
    結果就是中文字體都沒有黑體,斜體,無法直接實現中文的黑體,斜體了

 

對應上述問題,需要在AsciidocFX\conf\docbook-config\fo-pdf.xsl中修改生成樣式——修改兩個地方即可解決。

第一個地方原文:

    <xsl:attribute-set name="header.content.properties">
        <xsl:attribute name="font-family">Sans-serif,Arial</xsl:attribute>
        <xsl:attribute name="font-size">8pt</xsl:attribute>
    </xsl:attribute-set>

    <xsl:attribute-set name="footer.content.properties">
        <xsl:attribute name="font-family">Sans-serif,Arial</xsl:attribute>
        <xsl:attribute name="font-size">8pt</xsl:attribute>
    </xsl:attribute-set>

修改:

    <xsl:attribute-set name="header.content.properties">
        <xsl:attribute name="font-family">Arial Unicode MS,Sans-serif,Arial</xsl:attribute>
        <xsl:attribute name="font-size">8pt</xsl:attribute>
    </xsl:attribute-set>

    <xsl:attribute-set name="footer.content.properties">
        <xsl:attribute name="font-family">Arial Unicode MS,Sans-serif,Arial</xsl:attribute>
        <xsl:attribute name="font-size">8pt</xsl:attribute>
    </xsl:attribute-set>

 

第二個地方原文:

    <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="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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM