编辑:由于我的问题似乎特定于我的设置,我在这里提供了一个完整的最小工作示例。
这是我的 Maven 设置 ( pom.xml):
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0-SNAPSHOT</version>
<name>AsciiDoc Test</name>
<build>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.3</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>1.5.0-alpha.11</version>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>1.5.4</version>
</dependency>
<!-- beware, jruby 1.7.23 breaks asciidoctorj -->
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>1.7.21</version>
</dependency>
</dependencies>
<configuration>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
</configuration>
<executions>
<execution>
<id>generate-pdf-doc</id>
<phase>generate-resources</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>pdf</backend>
<doctype>book</doctype>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
这是我的 AsciiDoc 源代码 ( src/test.adoc):
[cols="a"]
|===
|First paragraph
second …Run Code Online (Sandbox Code Playgroud)
当使用 asciidoctor-pdf 转换为 PDF 时,我无法为 .adoc 文件设置字体大小(或样式)。根据文档,我可以指定它如下:
base:
font_size: 8
line_height_length: 10
Run Code Online (Sandbox Code Playgroud)
所以我把它放在我的 .adoc 文件的顶部。但是生成的 PDF 并未反映此更改。您能否提供一个 .adoc 文件作为示例,该文件指定不同的字体大小或样式?坦吉斯
我使用asciidoctor-pdf将adoc文档转换为pdf,但总是出现“不是已知字体”的错误,在命令行后添加--trace时,错误是
`initialize': is not a known font. (Prawn::Errors::UnknownFont)
/usr/local/lib/ruby/gems/2.4.0/gems/prawn-2.2.2/lib/prawn/font/afm.rb:53:in `initialize': is not a known font. (Prawn::Errors::UnknownFont)
from /usr/local/lib/ruby/gems/2.4.0/gems/prawn-2.2.2/lib/prawn/font.rb:301:in `new'
from /usr/local/lib/ruby/gems/2.4.0/gems/prawn-2.2.2/lib/prawn/font.rb:301:in `load'
from /usr/local/lib/ruby/gems/2.4.0/gems/prawn-2.2.2/lib/prawn/font.rb:253:in `find_font'
from /usr/local/lib/ruby/gems/2.4.0/gems/prawn-2.2.2/lib/prawn/font.rb:57:in `font'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.16/lib/asciidoctor-pdf/prawn_ext/extensions.rb:196:in `font'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.16/lib/asciidoctor-pdf/converter.rb:2930:in `theme_font'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.16/lib/asciidoctor-pdf/converter.rb:544:in `convert_admonition'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.16/lib/asciidoctor-pdf/converter.rb:118:in `convert'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.6.1/lib/asciidoctor/abstract_block.rb:70:in `convert'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.6.1/lib/asciidoctor/abstract_block.rb:79:in `block in content'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.6.1/lib/asciidoctor/abstract_block.rb:79:in `map'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.6.1/lib/asciidoctor/abstract_block.rb:79:in `content'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.6.1/lib/asciidoctor/block.rb:110:in `content'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.16/lib/asciidoctor-pdf/converter.rb:134:in `convert_content_for_block'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.16/lib/asciidoctor-pdf/converter.rb:479:in `convert_preamble'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-pdf-1.5.0.alpha.16/lib/asciidoctor-pdf/converter.rb:118:in `convert'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.6.1/lib/asciidoctor/abstract_block.rb:70:in `convert'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.6.1/lib/asciidoctor/abstract_block.rb:79:in `block in content'
from /usr/local/lib/ruby/gems/2.4.0/gems/asciidoctor-1.5.6.1/lib/asciidoctor/abstract_block.rb:79:in `map'
from …Run Code Online (Sandbox Code Playgroud)