asciidoctor-pdf 1.5.0.beta.1 → 1.5.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.adoc +26 -0
  3. data/README.adoc +2 -2
  4. data/asciidoctor-pdf.gemspec +3 -3
  5. data/bin/asciidoctor-pdf +1 -0
  6. data/data/fonts/ABOUT-mplus1mn-subset +24 -0
  7. data/data/fonts/ABOUT-mplus1p-subset +25 -0
  8. data/data/fonts/ABOUT-notoserif-subset +25 -0
  9. data/data/fonts/{LICENSE-mplus-testflight-58 → LICENSE-mplus} +2 -2
  10. data/data/fonts/{LICENSE-noto-2015-06-05 → LICENSE-notoserif} +0 -0
  11. data/data/fonts/mplus1mn-bold-ascii.ttf +0 -0
  12. data/data/fonts/mplus1mn-bold-subset.ttf +0 -0
  13. data/data/fonts/mplus1mn-bold_italic-ascii.ttf +0 -0
  14. data/data/fonts/mplus1mn-bold_italic-subset.ttf +0 -0
  15. data/data/fonts/mplus1mn-italic-ascii.ttf +0 -0
  16. data/data/fonts/mplus1mn-italic-subset.ttf +0 -0
  17. data/data/fonts/mplus1mn-regular-ascii-conums.ttf +0 -0
  18. data/data/fonts/mplus1mn-regular-subset.ttf +0 -0
  19. data/data/fonts/mplus1p-regular-fallback.ttf +0 -0
  20. data/data/fonts/notoserif-bold-subset.ttf +0 -0
  21. data/data/fonts/notoserif-bold_italic-subset.ttf +0 -0
  22. data/data/fonts/notoserif-italic-subset.ttf +0 -0
  23. data/data/fonts/notoserif-regular-subset.ttf +0 -0
  24. data/data/themes/base-theme.yml +8 -1
  25. data/data/themes/default-theme.yml +22 -7
  26. data/data/themes/default-with-fallback-font-theme.yml +4 -4
  27. data/docs/theming-guide.adoc +459 -44
  28. data/lib/asciidoctor-pdf.rb +1 -0
  29. data/lib/asciidoctor-pdf/asciidoctor_ext.rb +1 -0
  30. data/lib/asciidoctor-pdf/asciidoctor_ext/abstract_block.rb +1 -0
  31. data/lib/asciidoctor-pdf/asciidoctor_ext/document.rb +1 -0
  32. data/lib/asciidoctor-pdf/asciidoctor_ext/image.rb +1 -0
  33. data/lib/asciidoctor-pdf/asciidoctor_ext/list.rb +1 -0
  34. data/lib/asciidoctor-pdf/asciidoctor_ext/list_item.rb +1 -0
  35. data/lib/asciidoctor-pdf/asciidoctor_ext/logging_shim.rb +1 -0
  36. data/lib/asciidoctor-pdf/asciidoctor_ext/section.rb +1 -0
  37. data/lib/asciidoctor-pdf/converter.rb +227 -137
  38. data/lib/asciidoctor-pdf/core_ext.rb +1 -0
  39. data/lib/asciidoctor-pdf/core_ext/array.rb +1 -0
  40. data/lib/asciidoctor-pdf/core_ext/hash.rb +1 -0
  41. data/lib/asciidoctor-pdf/core_ext/numeric.rb +1 -0
  42. data/lib/asciidoctor-pdf/core_ext/object.rb +1 -0
  43. data/lib/asciidoctor-pdf/core_ext/quantifiable_stdout.rb +1 -0
  44. data/lib/asciidoctor-pdf/core_ext/regexp.rb +1 -0
  45. data/lib/asciidoctor-pdf/core_ext/string.rb +1 -0
  46. data/lib/asciidoctor-pdf/formatted_text.rb +1 -0
  47. data/lib/asciidoctor-pdf/formatted_text/formatter.rb +1 -0
  48. data/lib/asciidoctor-pdf/formatted_text/inline_destination_marker.rb +1 -0
  49. data/lib/asciidoctor-pdf/formatted_text/inline_image_arranger.rb +2 -1
  50. data/lib/asciidoctor-pdf/formatted_text/inline_image_renderer.rb +1 -0
  51. data/lib/asciidoctor-pdf/formatted_text/inline_text_aligner.rb +1 -0
  52. data/lib/asciidoctor-pdf/formatted_text/parser.rb +19 -6
  53. data/lib/asciidoctor-pdf/formatted_text/parser.treetop +2 -3
  54. data/lib/asciidoctor-pdf/formatted_text/text_background_and_border_renderer.rb +1 -0
  55. data/lib/asciidoctor-pdf/formatted_text/transform.rb +51 -3
  56. data/lib/asciidoctor-pdf/implicit_header_processor.rb +1 -0
  57. data/lib/asciidoctor-pdf/index_catalog.rb +1 -0
  58. data/lib/asciidoctor-pdf/measurements.rb +1 -0
  59. data/lib/asciidoctor-pdf/pdf-core_ext.rb +1 -0
  60. data/lib/asciidoctor-pdf/pdf-core_ext/page.rb +26 -0
  61. data/lib/asciidoctor-pdf/pdf-core_ext/pdf_object.rb +1 -0
  62. data/lib/asciidoctor-pdf/pdfmark.rb +1 -0
  63. data/lib/asciidoctor-pdf/prawn-svg_ext.rb +1 -0
  64. data/lib/asciidoctor-pdf/prawn-svg_ext/interface.rb +1 -0
  65. data/lib/asciidoctor-pdf/prawn-table_ext.rb +1 -0
  66. data/lib/asciidoctor-pdf/prawn-table_ext/cell.rb +1 -0
  67. data/lib/asciidoctor-pdf/prawn-table_ext/cell/asciidoc.rb +1 -0
  68. data/lib/asciidoctor-pdf/prawn-table_ext/cell/text.rb +1 -0
  69. data/lib/asciidoctor-pdf/prawn-templates_ext.rb +1 -0
  70. data/lib/asciidoctor-pdf/prawn_ext.rb +1 -0
  71. data/lib/asciidoctor-pdf/prawn_ext/coderay_encoder.rb +6 -5
  72. data/lib/asciidoctor-pdf/prawn_ext/extensions.rb +11 -17
  73. data/lib/asciidoctor-pdf/prawn_ext/font/afm.rb +15 -8
  74. data/lib/asciidoctor-pdf/prawn_ext/formatted_text/fragment.rb +1 -0
  75. data/lib/asciidoctor-pdf/prawn_ext/images.rb +2 -1
  76. data/lib/asciidoctor-pdf/roman_numeral.rb +1 -0
  77. data/lib/asciidoctor-pdf/rouge_ext.rb +1 -0
  78. data/lib/asciidoctor-pdf/rouge_ext/formatters/prawn.rb +1 -0
  79. data/lib/asciidoctor-pdf/rouge_ext/themes/asciidoctor_pdf_default.rb +1 -0
  80. data/lib/asciidoctor-pdf/rouge_ext/themes/bw.rb +1 -0
  81. data/lib/asciidoctor-pdf/sanitizer.rb +1 -0
  82. data/lib/asciidoctor-pdf/temporary_path.rb +1 -0
  83. data/lib/asciidoctor-pdf/theme_loader.rb +13 -13
  84. data/lib/asciidoctor-pdf/ttfunk_ext.rb +1 -0
  85. data/lib/asciidoctor-pdf/version.rb +2 -1
  86. data/lib/asciidoctor/pdf.rb +1 -0
  87. data/lib/asciidoctor/pdf/version.rb +1 -0
  88. metadata +15 -15
  89. data/lib/asciidoctor-pdf/core_ext/ostruct.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 032a48f8d8cda0a29e3e7c3249cb2c74aaccc0f910adcb4607ef30733b70b948
4
- data.tar.gz: 1e995ab8292dedab7deef06867f5da0ca41570be9abe88e6be81af999fe4965b
3
+ metadata.gz: 39073eb8a1bb2d5cac70b6909884e9c7e28813919295d5058c4471ea5805f103
4
+ data.tar.gz: e527403b220a3969d0398e9a6e3b4e3101fb9a55eafe9dacbe429b6abd8399ee
5
5
  SHA512:
6
- metadata.gz: 945a1f3e02ee7c08e7a08f5566dc9bf79aac394674f44665285cf40f7fbaf1bd16c2b2d491b37ad467a5e718c23fa311e245b46f4d46de3f1fe54badf83a69e9
7
- data.tar.gz: e3d6c083f0b4ecf716a2264127f523f4a8febfa0a2915838c31f67a4d2cf5201b2178d15a5e6b057528bad4d7b5f685cbc69a8dcaa44538359d2a27532ab8a4c
6
+ metadata.gz: 15142864ee5aa1ab97c6ec2c5c82793532528b10ebe093a3af8514c313c0c3f06b4a3aabc2c1d246546991332a6de7bd8772843373fd715a96b4d38d5f563228
7
+ data.tar.gz: 3c3d20aebe612eb3869fc5f38b8af536e5bb51ea95765cbe1c61515e36d03e0d62dbe97262629b581524a6d8783cb886c8bfc4832c6e5b4dab0dd3a4e4624a17
@@ -5,6 +5,32 @@
5
5
  This document provides a high-level view of the changes to the {project-name} by release.
6
6
  For a detailed view of what has changed, refer to the {uri-repo}/commits/master[commit history] on GitHub.
7
7
 
8
+ == 1.5.0.beta.2 (2019-07-30) - @mojavelinux
9
+
10
+ * only apply title page background image to the title page (#1144)
11
+ * make sure title page background or color (and only title page background or color) gets applied to title page even when page has already been created (#1144)
12
+ * fix crash when image_width is defined in theme (#995)
13
+ * fix crash when toc is enabled and toc-title attribute is unset
14
+ * correctly map legacy Font Awesome icon names when icon set is not specified (#1157)
15
+ * coerce color values in theme that contain uppercase letters (#1149)
16
+ * prevent table alignment from modifying margins of subsequent pages; only align table if width is less than bounds (#1170)
17
+ * ensure base font color is set
18
+ * use more robust mechanism to detect an empty page; tare content stream after adding page background color or image
19
+ * ignore pdf-themesdir unless pdf-theme is specified (#1167)
20
+ * allow theme to control glyphs used for conums (#133)
21
+ * allow theme to control background and border of inline kbd (#313, #1004)
22
+ * add support for link on image in running content (#1002)
23
+ * allow theme to disable font kerning
24
+ * add support for default theme alignment for tables (#1164)
25
+ * add theming support to (inline) roles on phrases (#368)
26
+ * allow theme to customize style of titles in running content (#1044)
27
+ * add support for the built-in big and small roles on phrases (#459)
28
+ * route AFM font warning through Asciidoctor logger
29
+ * upgrade code font (M+ 1mn) to TESTFLIGHT-63a
30
+ * include all alphanumeric characters in code font (mplus1mn) (#282)
31
+ * report clearer error message when theme can't be found or loaded
32
+ * document how to prepare a TTF font to work best with Asciidoctor PDF (#297)
33
+
8
34
  == 1.5.0.beta.1 (2019-07-08) - @mojavelinux
9
35
 
10
36
  * rename pdf-style and pdf-stylesdir attributes to pdf-theme and pdf-themesdir, respectively (while still honoring the old names for compatibility) (#1127)
@@ -1,6 +1,6 @@
1
1
  = Asciidoctor PDF: A native PDF converter for AsciiDoc
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>; Sarah White <https://github.com/graphitefriction[@graphitefriction]>
3
- v1.5.0.beta.1, 2019-07-08
3
+ v1.5.0.beta.2, 2019-07-30
4
4
  // Settings:
5
5
  :experimental:
6
6
  :idprefix:
@@ -24,7 +24,7 @@ endif::[]
24
24
  :project-name: Asciidoctor PDF
25
25
  :project-handle: asciidoctor-pdf
26
26
  // Variables:
27
- :release-version: 1.5.0.beta.1
27
+ :release-version: 1.5.0.beta.2
28
28
  // URIs:
29
29
  :uri-asciidoctor: http://asciidoctor.org
30
30
  :uri-gem: http://rubygems.org/gems/asciidoctor-pdf
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
40
40
  s.add_runtime_dependency 'prawn-table', '~> 0.2.0'
41
41
  s.add_runtime_dependency 'prawn-templates', '~> 0.1.0'
42
42
  s.add_runtime_dependency 'prawn-svg', '~> 0.29.0'
43
- s.add_runtime_dependency 'prawn-icon', '~> 2.3.0'
43
+ s.add_runtime_dependency 'prawn-icon', '~> 2.4.0'
44
44
  s.add_runtime_dependency 'safe_yaml', '~> 1.0.0'
45
45
  s.add_runtime_dependency 'thread_safe', '~> 0.3.0'
46
46
  s.add_runtime_dependency 'concurrent-ruby', '~> 1.1.0'
@@ -48,8 +48,8 @@ Gem::Specification.new do |s|
48
48
  s.add_runtime_dependency 'treetop', '~> 1.5.0'
49
49
 
50
50
  s.add_development_dependency 'rake', '~> 12.3.0'
51
- # Asciidoctor PDF supports Rouge >= 2; Rouge 3.4.1 emits a superfluous warning in verbose mode
52
- s.add_development_dependency 'rouge', '~> 3.4.0', '!= 3.4.1'
51
+ # Asciidoctor PDF supports Rouge >= 2 (verified in CI build using 2.0.0)
52
+ s.add_development_dependency 'rouge', '~> 3.6.0'
53
53
  s.add_development_dependency 'rspec', '~> 3.8.0'
54
54
  s.add_development_dependency 'pdf-inspector', '~> 1.3.0'
55
55
  s.add_development_dependency 'chunky_png', '~> 1.3.0'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  if File.file?(asciidoctor_pdf = (File.expand_path '../../lib/asciidoctor/pdf.rb', __FILE__))
4
5
  require asciidoctor_pdf
@@ -0,0 +1,24 @@
1
+ M+ fonts are generated from the M+ outline fonts TESTFLIGHT 63a retrieved from http://mplus-fonts.osdn.jp/mplus-outline-fonts/download/index-en.html.
2
+
3
+ The following changes were made using fontforge to produce mplus1mn-*-ascii.ttf fonts:
4
+
5
+ * Subsetted to include (ascii variant):
6
+ ** Non-visible Characters (U+00a0)
7
+ ** Basic Latin (U+0020–U+007e)
8
+ ** Enclosed Numbers (U+2460–U+2473, U+2776–U+277f, U+24eb–U+24f4) (M+ 1mn Regular only)
9
+ ** Box Drawing Symbols (U+2500–U+257f)
10
+ * Subsetted to include (subset variant):
11
+ ** Non-visible Characters (U+00a0)
12
+ ** Basic Latin (U+0020–U+007e)
13
+ ** Latin-1 Supplement (U+00a0–U+00fd)
14
+ ** Latin Extended-A (U+0100–U+017f)
15
+ ** Greek Alphabet (U+0391–U+03c9)
16
+ ** Cyrillic (U+0400–U+04ff)
17
+ ** Assorted Symbols (U+20ac)
18
+ ** Enclosed Numbers (U+2460–U+2473, U+2776–U+277f, U+24eb–U+24f4) (mplus1mn-regular only)
19
+ ** Box Drawing Symbols (U+2500–U+257f)
20
+ * Added BOM (U+feff) and line feed (U+000a) characters (from blank)
21
+ * Generated old-style kern table (neither Apple or OpenType) (required to make kerning work in Prawn) (flags: 0x90)
22
+ * Removed Truetype instructions (information not used by Prawn) (flags: 0x08)
23
+ * Generated with PS Glyph Names option enabled (didn't use 0x04 flag)
24
+ * Generate flags used, in total: 0x90 + 0x08
@@ -0,0 +1,25 @@
1
+ M+ fonts are generated from the M+ outline fonts TESTFLIGHT 63a retrieved from http://mplus-fonts.osdn.jp/mplus-outline-fonts/download/index-en.html.
2
+
3
+ The following changes were made using fontforge to produce mplus1p-regular-fallback.ttf font:
4
+
5
+ * Subsetted to include:
6
+ ** Non-visible Characters (U+00a0)
7
+ ** Basic Latin (U+0020–U+007e)
8
+ ** Latin-1 Supplement (U+00a0–U+00fd)
9
+ ** Latin Extended-A (U+0100–U+017f)
10
+ ** Latin Extended-B (U+0180–U+024f)
11
+ ** IPA (U+0259, U+02b0–U+02ff)
12
+ ** Greek (U+0370–U+03ff)
13
+ ** Cyrillic (U+0400–U+04ff)
14
+ ** Vietnamese (U+01a0–U01b0, U+1ea0–U1ef9)
15
+ ** CJK (U+4e00–U+9fff, U+3000–U+303f) (mostly Japanese, limited selection based on what M+ supports)
16
+ ** Mathematical Operators (U+2200–U+22ff)
17
+ ** General Punctuation (U+2000–U203a)
18
+ ** Geometric Shapes (U+25a0–U25ff)
19
+ ** Assorted Symbols (U+20ac, U+2122, U+21d0–U+21d5, U+2190–U+2195, U+2610–U+2611, U+2713)
20
+ * Added BOM (U+feff), hair space (U+200a), zero-width space (U+200b) and line feed (U+000a) characters (from blank)
21
+ * Manually added non-breaking hyphen (U+2011) from hyphen (U+002d)
22
+ * Generated old-style kern table (neither Apple or OpenType) (required to make kerning work in Prawn) (flags: 0x90)
23
+ * Removed Truetype instructions (information not used by Prawn) (flags: 0x08)
24
+ * Generated with PS Glyph Names option enabled (didn't use 0x04 flag)
25
+ * Generate flags used, in total: 0x90 + 0x08
@@ -0,0 +1,25 @@
1
+ Noto Serif fonts are generated from the google-noto-serif-fonts-20161022 Fedora RPM package Noto Serif.
2
+
3
+ The following changes were made using fontforge to produce the notoserif-*-subset.ttf fonts:
4
+
5
+ * Mapped single arrows <- (U+2190) and -> (U+2192) to double arrows <= (U+21d0) and => (U+21d2)
6
+ * Manually added non-breaking hyphen (U+2011) from hyphen (U+002d)
7
+ * Moved arrows (U+21d0, U+21d2, U+2190, U+2192) up in line to align with middle of X
8
+ * Subsetted to include:
9
+ ** Non-visible Characters (U+feff, U+00a0)
10
+ ** Basic Latin (U+0020–U+007e)
11
+ ** Latin-1 Supplement (U+00a0–U+00fd)
12
+ ** Latin Extended-A (U+0100–U+017f)
13
+ ** Greek (U+0370–U+03ff)
14
+ ** Cyrillic (U+0400–U+04ff)
15
+ ** Vietnamese (U+01a0–U01b0, U+1ea0–U1ef9)
16
+ ** Mathematical Operators (U+2200–U+22ff)
17
+ ** General Punctuation (U+2000–U203a)
18
+ ** Geometric Shapes (U+25a0–U25ff)
19
+ ** Assorted Symbols (U+20ac, U+2122, U+21d0, U+21d2, U+2190, U+2192)
20
+ * Imported ballot boxes from Font Awesome (U+2610, U+2611) (Noto Serif Regular only)
21
+ * Added line feed character (U+000a)
22
+ * Generated old-style kern table (neither Apple or OpenType) (required to make kerning work in Prawn) (flags: 0x90)
23
+ * Removed Truetype instructions (information not used by Prawn)
24
+ * Generated with PS Glyph Names option enabled (didn't use 0x04 flag)
25
+ * Generate flags used, in total: 0x90 + 0x08
@@ -1,4 +1,4 @@
1
- M+ FONTS Copyright (C) 2002-2014 M+ FONTS PROJECT
1
+ M+ FONTS Copyright (C) 2002-2019 M+ FONTS PROJECT
2
2
 
3
3
  -
4
4
 
@@ -13,4 +13,4 @@ or without modification, either commercially or noncommercially.
13
13
  THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY.
14
14
 
15
15
 
16
- http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/
16
+ http://mplus-fonts.osdn.jp
@@ -21,9 +21,13 @@ base_line_height: 1.15
21
21
  base_line_height_length: 13.8
22
22
  base_border_color: 'EEEEEE'
23
23
  base_border_width: 0.5
24
+ role_big_font_size: 14
25
+ role_small_font_size: 10
24
26
  button_content: '[%s]'
25
27
  button_font_family: Courier
26
28
  button_font_style: bold
29
+ key_font_family: Courier
30
+ key_font_style: italic
27
31
  link_font_color: '0000EE'
28
32
  literal_font_family: Courier
29
33
  heading_font_style: bold
@@ -68,12 +72,13 @@ blockquote_border_color: 'EEEEEE'
68
72
  blockquote_border_width: 4
69
73
  blockquote_padding: [6, 12, -6, 14]
70
74
  code_font_family: Courier
71
- code_font_size: 10.5
75
+ code_font_size: 10.8
72
76
  code_line_height: 1.2
73
77
  code_padding: 9
74
78
  code_border_color: 'EEEEEE'
75
79
  code_border_width: 0.5
76
80
  conum_line_height: 1.15
81
+ conum_glyphs: circled
77
82
  example_background_color: 'FFFFFF'
78
83
  example_border_color: 'EEEEEE'
79
84
  example_border_width: 0.5
@@ -101,3 +106,5 @@ thematic_break_border_style: solid
101
106
  thematic_break_border_width: 0.5
102
107
  toc_indent: 15
103
108
  toc_line_height: 1.4
109
+ footnotes_font_size: 9
110
+ footnotes_item_space: 3
@@ -8,10 +8,10 @@ font:
8
8
  bold_italic: notoserif-bold_italic-subset.ttf
9
9
  # M+ 1mn supports ASCII and the circled numbers used for conums
10
10
  M+ 1mn:
11
- normal: mplus1mn-regular-ascii-conums.ttf
12
- bold: mplus1mn-bold-ascii.ttf
13
- italic: mplus1mn-italic-ascii.ttf
14
- bold_italic: mplus1mn-bold_italic-ascii.ttf
11
+ normal: mplus1mn-regular-subset.ttf
12
+ bold: mplus1mn-bold-subset.ttf
13
+ italic: mplus1mn-italic-subset.ttf
14
+ bold_italic: mplus1mn-bold_italic-subset.ttf
15
15
  page:
16
16
  background_color: ffffff
17
17
  layout: portrait
@@ -51,6 +51,12 @@ base:
51
51
  border_color: eeeeee
52
52
  border_radius: 4
53
53
  border_width: 0.5
54
+ role:
55
+ big:
56
+ font_size: $base_font_size_large
57
+ role:
58
+ small:
59
+ font_size: $base_font_size_small
54
60
  # FIXME vertical_rhythm is weird; we should think in terms of ems
55
61
  #vertical_rhythm: $base_line_height_length * 2 / 3
56
62
  # correct line height for Noto Serif metrics (comes with built-in line height)
@@ -58,15 +64,23 @@ vertical_rhythm: $base_line_height_length
58
64
  horizontal_rhythm: $base_line_height_length
59
65
  # QUESTION should vertical_spacing be block_spacing instead?
60
66
  vertical_spacing: $vertical_rhythm
61
- button:
62
- content: "[\u2009%s\u2009]"
63
- font_style: bold
64
67
  link:
65
68
  font_color: 428bca
66
69
  # literal is currently used for inline monospaced in prose and table cells
67
70
  literal:
68
71
  font_color: b12146
69
72
  font_family: M+ 1mn
73
+ button:
74
+ content: "[\u2009%s\u2009]"
75
+ font_style: bold
76
+ key:
77
+ background_color: f5f5f5
78
+ border_color: cccccc
79
+ border_offset: 1.5
80
+ border_radius: 2
81
+ border_width: 0.375
82
+ font_family: $literal_font_family
83
+ separator: "\u202f+\u202f"
70
84
  menu:
71
85
  caret_content: " <font size=\"1.15em\"><color rgb=\"b12146\">\u203a</color></font> "
72
86
  heading:
@@ -172,6 +186,7 @@ conum:
172
186
  font_color: $literal_font_color
173
187
  font_size: $base_font_size
174
188
  line_height: 4 / 3
189
+ glyphs: circled
175
190
  example:
176
191
  border_color: $base_border_color
177
192
  border_radius: $base_border_radius
@@ -7,10 +7,10 @@ font:
7
7
  italic: notoserif-italic-subset.ttf
8
8
  bold_italic: notoserif-bold_italic-subset.ttf
9
9
  M+ 1mn:
10
- normal: mplus1mn-regular-ascii-conums.ttf
11
- bold: mplus1mn-bold-ascii.ttf
12
- italic: mplus1mn-italic-ascii.ttf
13
- bold_italic: mplus1mn-bold_italic-ascii.ttf
10
+ normal: mplus1mn-regular-subset.ttf
11
+ bold: mplus1mn-bold-subset.ttf
12
+ italic: mplus1mn-italic-subset.ttf
13
+ bold_italic: mplus1mn-bold_italic-subset.ttf
14
14
  # M+ 1p supports Latin, Latin-1 Supplement, Latin Extended, Greek, Cyrillic, Vietnamese, Japanese & an assortment of symbols
15
15
  # It also provides arrows for ->, <-, => and <= replacements in case these glyphs are missing from font
16
16
  M+ 1p Fallback:
@@ -4,6 +4,7 @@ Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
4
4
  :idprefix:
5
5
  :idseparator: -
6
6
  :toc: preamble
7
+ :experimental:
7
8
  ifndef::env-github[:icons: font]
8
9
  ifdef::env-github[]
9
10
  :outfilesuffix: .adoc
@@ -19,6 +20,8 @@ endif::[]
19
20
  :conum-guard-yaml: #
20
21
  ifndef::icons[:conum-guard-yaml: # #]
21
22
  ifdef::backend-pdf[:conum-guard-yaml: # #]
23
+ :url-fontforge: https://fontforge.github.io/en-US/
24
+ :url-fontforge-scripting: https://fontforge.github.io/en-US/documentation/scripting/
22
25
 
23
26
  ////
24
27
  Topics remaining to document:
@@ -31,12 +34,12 @@ Topics remaining to document:
31
34
  The theming system in Asciidoctor PDF is used to control the layout and styling of the PDF file Asciidoctor PDF generates from AsciiDoc.
32
35
  This document describes how the theming system works, how to define a custom theme in YAML and how to activate the theme when running Asciidoctor PDF.
33
36
 
34
- IMPORTANT: If you're creating a custom theme, you're expected to supply your own fonts.
35
- We recognize this can be a major obstacle when you're starting out.
36
- Therefore, your other option is to simply redeclare the fonts from the https://github.com/asciidoctor/asciidoctor-pdf/blob/master/data/themes/default-theme.yml[default theme] in the <<Custom Fonts,font catalog>>.
37
- Asciidoctor PDF will then resolve the fonts that are bundled with the gem.
37
+ TIP: The quickest way to get started creating your own theme is to <<Extends,extend the default theme>>.
38
+ This not only gives you all the styles you need to build on, but also a collection of <<Bundled Fonts,bundled fonts>>.
39
+ If you override the font catalog in your theme file, you must declare all the fonts you use (and provide the font files themselves).
40
+ Insted, if you want to reuse the bundled fonts, simply reference the <<Bundled Fonts,bundled fonts>> in the <<Custom Fonts,font catalog>>.
38
41
 
39
- WARNING: If you don't declare your own fonts, the built-in (AFM) fonts declared in https://github.com/asciidoctor/asciidoctor-pdf/blob/master/data/themes/base-theme.yml[base theme] will be used instead.
42
+ WARNING: If you don't declare your own fonts (or extend the default theme), only the built-in (AFM) fonts provided by the PDF reader will be available.
40
43
  Using AFM fonts can result in missing functionality and warnings.
41
44
  See the <<Built-In (AFM) Fonts>> section to learn more about these limitations.
42
45
 
@@ -186,23 +189,23 @@ Also note the presence of the colon (`:`) after each key name.
186
189
  The value of a key may be one of the following types:
187
190
 
188
191
  * String
189
- - Font family name (e.g., Roboto)
190
- - Font style (normal, bold, italic, bold_italic)
191
- - Alignment (left, center, right, justify)
192
- - Color as hex string (e.g., 'ff0000', #ff0000, or '#ff0000')
193
- - Image path
194
- - Enumerated type (where specified)
195
- - Text content (where specified)
192
+ ** Font family name (e.g., Roboto)
193
+ ** Font style (normal, bold, italic, bold_italic)
194
+ ** Alignment (left, center, right, justify)
195
+ ** Color as hex string (e.g., 'ff0000', #ff0000, or '#ff0000')
196
+ ** Image path
197
+ ** Enumerated type (where specified)
198
+ ** Text content (where specified)
196
199
  * Null (clears any previously assigned value)
197
- - _empty_ (i.e., no value specified)
198
- - null
199
- - ~
200
+ ** _empty_ (i.e., no value specified)
201
+ ** null
202
+ ** ~
200
203
  * Number (integer or float) with optional units (default unit is points)
201
204
  * Array
202
- - Color as RGB array (e.g., [51, 51, 51])
203
- - Color CMYK array (e.g., [50, 100, 0, 0])
204
- - Margin (e.g., [1in, 1in, 1in, 1in])
205
- - Padding (e.g., [1in, 1in, 1in, 1in])
205
+ ** Color as RGB array (e.g., [51, 51, 51])
206
+ ** Color CMYK array (e.g., [50, 100, 0, 0])
207
+ ** Margin (e.g., [1in, 1in, 1in, 1in])
208
+ ** Padding (e.g., [1in, 1in, 1in, 1in])
206
209
  * Variable reference (e.g., $base_font_color or $base-font-color)
207
210
  * Math expression
208
211
 
@@ -687,7 +690,7 @@ For anything outside of that, PDF is BYOF (Bring Your Own Font).
687
690
  Even though the built-in fonts require the content to be encoded in WINANSI, _you still type your AsciiDoc document in UTF-8_.
688
691
  Asciidoctor PDF encodes the content into WINANSI when building the PDF.
689
692
 
690
- CAUTION: Built-in fonts do not use the <<fallback-fonts,fallback fonts>>.
693
+ WARNING: Built-in (AFM) fonts do not use the <<fallback-fonts,fallback fonts>>.
691
694
  In order for the fallback font to kick in, you must be using a TrueType font.
692
695
 
693
696
  .WINANSI Encoding Behavior
@@ -726,7 +729,7 @@ Also provides the circuled numbers used in callouts.
726
729
  http://mplus-fonts.osdn.jp/mplus-outline-fonts/design/index-en.html#mplus_1p[M+ 1p Fallback]::
727
730
  A sans-serif font that provides a very complete set of Unicode glyphs.
728
731
  Cannot be styled as italic, bold or bold_italic.
729
- Used as the fallback font.
732
+ Used as the fallback font in the `default-with-fallback-font` theme.
730
733
 
731
734
  CAUTION: At the time of this writing, you cannot use the bundled fonts if you change the value of the `pdf-fontsdir` attribute (and thus define your own custom fonts).
732
735
  This limitation may be lifted in the future.
@@ -736,8 +739,8 @@ This limitation may be lifted in the future.
736
739
  The limited character set of WINANSI, or the bland look of the built-in fonts, may motivate you to load your own font.
737
740
  Custom fonts can enhance the look of your PDF theme substantially.
738
741
 
739
- To start, you need to find a TTF file collection for the font you want to use.
740
- A collection typically consists of all four styles of a font:
742
+ To start, find the TTF file collection for the font you want to use.
743
+ A collection typically consists of all four font styles:
741
744
 
742
745
  * normal
743
746
  * italic
@@ -745,13 +748,16 @@ A collection typically consists of all four styles of a font:
745
748
  * bold_italic
746
749
 
747
750
  You'll need all four styles to support AsciiDoc content properly.
748
- _Asciidoctor PDF cannot italicize a font dynamically like a browser can, so you need the italic style._
751
+ _Asciidoctor PDF cannot italicize a font dynamically like a browser can, so the italic styles are required._
749
752
 
750
- Once you've obtained the TTF files, put them into a directory in your project where you want to store the fonts.
753
+ In order for a third-party font to work properly with Prawn (and hence Asciidoctor PDF), several modifications are required.
754
+ See <<Prepare a Custom Font>> to learn how to prepare your font for use with Asciidoctor PDF.
755
+
756
+ Once you've obtained the TTF files, put them in the directory inside your project where you want to store the fonts.
751
757
  It's recommended that you name them consistently so it's easier to type the names in the theme file.
752
758
 
753
759
  Let's assume the name of the font is https://github.com/google/roboto/tree/master/out/RobotoTTF[Roboto].
754
- Name the files as follows:
760
+ Rename the files as follows:
755
761
 
756
762
  * roboto-normal.ttf (_originally Roboto-Regular.ttf_)
757
763
  * roboto-italic.ttf (_originally Roboto-Italic.ttf_)
@@ -772,7 +778,7 @@ font:
772
778
  ----
773
779
 
774
780
  You can use the key that you assign to the font in the font catalog anywhere the `font-family` property is accepted in the theme file.
775
- For instance, to use the Roboto font for all headings, you'd use:
781
+ For example, to use the Roboto font for all headings, use:
776
782
 
777
783
  [source,yaml]
778
784
  ----
@@ -780,16 +786,18 @@ heading:
780
786
  font-family: Roboto
781
787
  ----
782
788
 
783
- When you execute Asciidoctor PDF, you need to specify the directory where the fonts reside using the `pdf-fontsdir` attribute:
789
+ When you execute Asciidoctor PDF, specify the directory where the fonts reside using the `pdf-fontsdir` attribute:
784
790
 
785
791
  $ asciidoctor-pdf -a pdf-theme=basic-theme.yml -a pdf-fontsdir=path/to/fonts document.adoc
786
792
 
787
793
  WARNING: Currently, all fonts referenced by the theme need to be present in the directory specified by the `pdf-fontsdir` attribute.
788
794
 
789
- When Asciidoctor PDF creates the PDF, it only embeds the glyphs from the font that are needed to render the characters present in the document.
790
- In other words, Asciidoctor PDF automatically subsets the font.
791
- However, if you're storing the fonts in a repository, you may want to subset the font (for instance, by using FontForge) to reduce the space the font occupies in that storage.
792
- This is simply a personal preference.
795
+ TIP: When Asciidoctor PDF creates the PDF, it only embeds the glyphs from the font that are needed to render the characters present in the document.
796
+ Effectively, it subsets the font.
797
+ While that saves space taken up by the generated PDF, you may still be storing the full font in your source repository.
798
+ To minimize the size of the source font, you can use {url-fontforge}[FontForge] to subset the font ahead of time.
799
+ Subsetting a font means remove glyphs you don't plan to use.
800
+ Doing so it not a requirement, simply a personal preference.
793
801
 
794
802
  You can add any number of fonts to the catalog.
795
803
  Each font must be assigned a unique key, as shown here:
@@ -810,22 +818,23 @@ font:
810
818
  bold_italic: roboto-light-bold_italic.ttf
811
819
  ----
812
820
 
813
- TIP: Text in SVGs will use the font catalog from your theme.
814
- We recommend that you match the font key to the name of the font seen by the operating system.
815
- This will allow you to use the same font names (aka families) in both your graphics program and Asciidoctor PDF.
821
+ Text in SVGs will use the font catalog from your theme.
822
+ We recommend that you match the font key in your theme file to the name of the font seen by the operating system.
823
+ This will allow you to use the same font names (aka families) in both your graphics program and Asciidoctor PDF, thus making them portable.
816
824
 
817
825
  === Fallback Fonts
818
826
 
819
827
  If a TrueType font is missing a character needed to render the document, such as a special symbol, you can have Asciidoctor PDF look for the character in a fallback font.
820
828
  You only need to specify a single fallback font, typically one that provides a full set of symbols.
821
829
 
822
- IMPORTANT: The fallback font is only used when the primary font is a TrueType font (i.e., TTF, DFont, TTC).
830
+ IMPORTANT: The fallback font only gets used when the primary font is a TrueType font (i.e., TTF, DFont, TTC).
823
831
  Any glyph missing from an AFM font is simply replaced with the "`not`" glyph (`&#172;`).
824
832
 
825
- CAUTION: Using the fallback font slows down PDF generation slightly because it has to analyze every single character.
833
+ CAUTION: The `default` theme does not use a fallback font.
834
+ However, the built-in `default-with-fallback-font` theme does.
835
+ Using the fallback font slows down PDF generation slightly because it has to analyze every single character.
826
836
  It's use is not recommended for large documents.
827
837
  Instead, it's best to select primary fonts that have all the characters you need.
828
- Keep in mind that the default theme currently uses a fallback font, though this may change in the future.
829
838
 
830
839
  Like with other custom fonts, you first need to declare the fallback font.
831
840
  Let's choose https://github.com/android/platform_frameworks_base/blob/master/data/fonts/DroidSansFallback.ttf[Droid Sans Fallback].
@@ -866,7 +875,7 @@ font:
866
875
  bold: droid-sans-fallback.ttf
867
876
  bold_italic: droid-sans-fallback.ttf
868
877
  fallbacks:
869
- - DroidSansFallback
878
+ - DroidSansFallback
870
879
  ----
871
880
 
872
881
  TIP: If you are using more than one fallback font, add additional lines to the `fallbacks` key.
@@ -881,7 +890,7 @@ base:
881
890
 
882
891
  That's it!
883
892
  Now you're covered.
884
- If your custom font is missing a glyph, Asciidoctor PDF will look in your fallback font.
893
+ If your custom TTF font is missing a glyph, Asciidoctor PDF will look in your fallback font.
885
894
  You don't need to reference the fallback font anywhere else in your theme file.
886
895
 
887
896
  == Keys
@@ -907,6 +916,15 @@ Therefore, you only have to declare keys that you want to override.
907
916
  === Extends
908
917
 
909
918
  A theme can extend another theme using the `extends` key.
919
+ For example:
920
+
921
+ [source,yaml]
922
+ ----
923
+ extends: default
924
+ base:
925
+ font-color: #ff0000
926
+ ----
927
+
910
928
  The extends key accepts either a single value or an array of values.
911
929
  Each value is interpreted as a filename.
912
930
  If the filename equals `default`, it resolves to the location of the default (built-in) theme.
@@ -931,6 +949,67 @@ Each time a theme is loaded, the keys are overlaid onto the keys from the previo
931
949
  - ./brand-theme.yml
932
950
  |===
933
951
 
952
+ [#keys-role]
953
+ === Role
954
+
955
+ The keys in the `role` category define custom roles for formatting.
956
+ The name of the role is the first subkey level.
957
+ The role name may not contain a hyphen or underscore.
958
+ The keys under the role are the concrete theming properties.
959
+
960
+ Here's an example of a role for making text red:
961
+
962
+ [source,yaml]
963
+ ----
964
+ role:
965
+ red:
966
+ font-color: #ff0000
967
+ ----
968
+
969
+ This role can be used as follows:
970
+
971
+ [source,asciidoc]
972
+ ----
973
+ Error text is shown in [.red]#red#.
974
+ ----
975
+
976
+ Currently, custom roles only apply to inline phrases and only support changing the font properties.
977
+
978
+ [cols="3,4,5l"]
979
+ |===
980
+ |Key |Value Type |Example
981
+
982
+ 3+|[#key-prefix-role]*Key Prefix:* <<key-prefix-role,role-<name> >>
983
+
984
+ |font-color
985
+ |<<colors,Color>> +
986
+ (default: _inherit_)
987
+ |role:
988
+ red:
989
+ font-color: #ff0000
990
+
991
+ |font-family
992
+ |<<fonts,Font family name>> +
993
+ (default: Courier)
994
+ |role:
995
+ label:
996
+ font-family: M+ 1mn
997
+
998
+ |font-size
999
+ |<<values,Number>> +
1000
+ (default: _inherit_)
1001
+ |role:
1002
+ large:
1003
+ font-size: 12
1004
+
1005
+ |font-style
1006
+ |<<font-styles,Font style>> +
1007
+ (default: _inherit_)
1008
+ |role:
1009
+ heavy:
1010
+ font-style: bold
1011
+ |===
1012
+
934
1013
  [#keys-page]
935
1014
  === Page
936
1015
 
@@ -1062,6 +1141,12 @@ NOTE: While it's common to define additional keys in this category (e.g., `base-
1062
1141
  |base:
1063
1142
  font-family: Noto Serif
1064
1143
 
1144
+ |font-kerning
1145
+ |normal {vbar} default +
1146
+ (default: normal)
1147
+ |base:
1148
+ font-kerning: none
1149
+
1065
1150
  |font-size
1066
1151
  |<<values,Number>> +
1067
1152
  (default: 12)
@@ -1187,6 +1272,36 @@ The keys in this category are used for inline monospaced text in prose and table
1187
1272
 
1188
1273
  3+|[#key-prefix-literal]*Key Prefix:* <<key-prefix-literal,literal>>
1189
1274
 
1275
+ |background-color
1276
+ |<<colors,Color>> +
1277
+ (default: _not set_)
1278
+ |literal:
1279
+ background-color: #f5f5f5
1280
+
1281
+ |border-color^[1]^
1282
+ |<<colors,Color>> +
1283
+ (default: _not set_)
1284
+ |literal:
1285
+ border-color: #cccccc
1286
+
1287
+ |border-offset^[2]^
1288
+ |<<values,Number>> +
1289
+ (default: 0)
1290
+ |literal:
1291
+ border-offset: 2
1292
+
1293
+ |border-radius
1294
+ |<<values,Number>> +
1295
+ (default: _not set_)
1296
+ |literal:
1297
+ border-radius: 3
1298
+
1299
+ |border-width
1300
+ |<<values,Number>> +
1301
+ (default: $base-border-width)
1302
+ |literal:
1303
+ border-width: 0.5
1304
+
1190
1305
  |font-color
1191
1306
  |<<colors,Color>> +
1192
1307
  (default: _inherit_)
@@ -1211,6 +1326,11 @@ The keys in this category are used for inline monospaced text in prose and table
1211
1326
  |literal:
1212
1327
  font-style: bold
1213
1328
  |===
1329
+ . The border is only used if a border color is specified and the border width is not explicitly set to 0.
1330
+ The border only works properly if the literal phrase does not have nested formatting.
1331
+ Otherwise, the border will be inherited, producing a less than desirable result.
1332
+ . The border offset is the amount that the background and border swells around the text.
1333
+ It does not affect the distance between the formatted phrase and the phrases that surround it.
1214
1334
 
1215
1335
  [#keys-heading]
1216
1336
  === Heading
@@ -1852,7 +1972,7 @@ The keys in this category are used to control the style of literal, listing and
1852
1972
 
1853
1973
  |font-size
1854
1974
  |<<values,Number>> +
1855
- (default: 10.5)
1975
+ (default: 10.8)
1856
1976
  |code:
1857
1977
  font-size: 11
1858
1978
 
@@ -1895,7 +2015,7 @@ Otherwise, the style is controlled by the source highlighter theme.
1895
2015
  [#keys-callout-numbers]
1896
2016
  === Callout Numbers
1897
2017
 
1898
- The keys in this category are used to control the style of callout numbers (conums) inside verbatim blocks and in callout lists (colists).
2018
+ The keys in this category are used to control the style of callout numbers (i.e., conums) inside verbatim blocks and in callout lists (colists).
1899
2019
 
1900
2020
  [cols="3,4,5l"]
1901
2021
  |===
@@ -1932,11 +2052,171 @@ The keys in this category are used to control the style of callout numbers (conu
1932
2052
  (default: 1.15)
1933
2053
  |conum:
1934
2054
  line-height: 4 / 3
2055
+
2056
+ |glyphs^[2]^
2057
+ |circled {vbar} filled {vbar} Unicode String ranges +
2058
+ (default: circled)
2059
+ |conum:
2060
+ glyphs: \u0031-\u0039
1935
2061
  |===
1936
2062
 
1937
2063
  . Currently, the font must contain the circle numbers starting at glyph U+2460.
1938
2064
  . font-family, font-size, font-style, and line-height are only used for markers in a colist.
1939
2065
  These properties are inherited for conums inside a verbatim block.
2066
+ . The font must provide the required glyphs.
2067
+ The glyphs can be specified as a comma-separated list of ranges, where the range values are Unicode numbers (e.g., \u2460).
2068
+
2069
+ [#keys-button]
2070
+ === Button
2071
+
2072
+ The keys in this category apply to a button reference (generated from the inline button macro).
2073
+
2074
+ [cols="3,4,5l"]
2075
+ |===
2076
+ |Key |Value Type |Example
2077
+
2078
+ 3+|[#key-prefix-button]*Key Prefix:* <<key-prefix-button,button>>
2079
+
2080
+ |background-color
2081
+ |<<colors,Color>> +
2082
+ (default: _not set_)
2083
+ |button:
2084
+ background-color: #0000ff
2085
+
2086
+ |border-color^[1]^
2087
+ |<<colors,Color>> +
2088
+ (default: _not set_)
2089
+ |button:
2090
+ border-color: #cccccc
2091
+
2092
+ |border-offset^[2]^
2093
+ |<<values,Number>> +
2094
+ (default: 0)
2095
+ |button:
2096
+ border-offset: 1.5
2097
+
2098
+ |border-radius
2099
+ |<<values,Number>> +
2100
+ (default: 0)
2101
+ |button:
2102
+ border-radius: 2
2103
+
2104
+ |border-width
2105
+ |<<values,Number>> +
2106
+ (default: $base-border-width)
2107
+ |button:
2108
+ border-width: 0.5
2109
+
2110
+ |content^[3]^
2111
+ |<<quoted-string,Quoted string>> +
2112
+ (default: "%s")
2113
+ |button:
2114
+ content: "[\u2009%s\u2009]"
2115
+
2116
+ |font-color
2117
+ |<<colors,Color>> +
2118
+ (default: _inherit_)
2119
+ |button:
2120
+ font-color: #ffffff
2121
+
2122
+ |font-family
2123
+ |<<fonts,Font family name>> +
2124
+ (default: Courier)
2125
+ |button:
2126
+ font-family: M+ 1mn
2127
+
2128
+ |font-size
2129
+ |<<values,Number>> +
2130
+ (default: _inherit_)
2131
+ |button:
2132
+ font-size: 12
2133
+
2134
+ |font-style
2135
+ |<<font-styles,Font style>> +
2136
+ (default: bold)
2137
+ |button:
2138
+ font-style: normal
2139
+ |===
2140
+ . The border is only used if a border color is specified and the border width is not explicitly set to 0.
2141
+ . The border offset is the amount that the background and border swells around the text.
2142
+ It does not affect the distance between the formatted phrase and the phrases that surround it.
2143
+ . The character sequence `%s` in the content key gets replaced with the button label.
2144
+
2145
+ [#keys-key]
2146
+ === Key
2147
+
2148
+ The keys in this category apply to a key reference (generated from the inline kbd macro).
2149
+
2150
+ [cols="3,4,5l"]
2151
+ |===
2152
+ |Key |Value Type |Example
2153
+
2154
+ 3+|[#key-prefix-key]*Key Prefix:* <<key-prefix-key,key>>
2155
+
2156
+ |background-color
2157
+ |<<colors,Color>> +
2158
+ (default: _not set_)
2159
+ |key:
2160
+ background-color: #fafafa
2161
+
2162
+ |border-color^[1]^
2163
+ |<<colors,Color>> +
2164
+ (default: _not set_)
2165
+ |key:
2166
+ border-color: #cccccc
2167
+
2168
+ |border-offset^[2]^
2169
+ |<<values,Number>> +
2170
+ (default: 0)
2171
+ |key:
2172
+ border-offset: 1.5
2173
+
2174
+ |border-radius
2175
+ |<<values,Number>> +
2176
+ (default: 0)
2177
+ |key:
2178
+ border-radius: 2
2179
+
2180
+ |border-width
2181
+ |<<values,Number>> +
2182
+ (default: $base-border-width)
2183
+ |key:
2184
+ border-width: 0.375
2185
+
2186
+ |separator^[3]^
2187
+ |<<quoted-string,Quoted string>> +
2188
+ (default: "+")
2189
+ |key:
2190
+ separator: "\u2009+\u2009"
2191
+
2192
+ |font-color
2193
+ |<<colors,Color>> +
2194
+ (default: _inherit_)
2195
+ |key:
2196
+ font-color: #000
2197
+
2198
+ |font-family
2199
+ |<<fonts,Font family name>> +
2200
+ (default: Courier)
2201
+ |key:
2202
+ font-family: $base-font-family
2203
+
2204
+ |font-size
2205
+ |<<values,Number>> +
2206
+ (default: _inherit_)
2207
+ |key:
2208
+ font-size: 10.5
2209
+
2210
+ |font-style
2211
+ |<<font-styles,Font style>> +
2212
+ (default: italic)
2213
+ |key:
2214
+ font-style: normal
2215
+ |===
2216
+ . The border is only used if a border color is specified and the border width is not explicitly set to 0.
2217
+ . The border offset is the amount that the background and border swells around the text.
2218
+ It does not affect the distance between the formatted phrase and the phrases that surround it.
2219
+ . The separator is only used for multi-key sequences.
1940
2220
 
1941
2221
  [#keys-menu]
1942
2222
  === Menu
@@ -2435,6 +2715,25 @@ The keys in this category control the arrangement of block images.
2435
2715
  . Only applies to block images.
2436
2716
  If specified, this value takes precedence over the value of the `width` attribute on the image macro, but not over the value of the `pdfwidth` attribute.
2437
2717
 
2718
+ [#keys-svg]
2719
+ === SVG
2720
+
2721
+ The keys in this category control the SVG integration.
2722
+
2723
+ [cols="3,4,5l"]
2724
+ |===
2725
+ |Key |Value Type |Example
2726
+
2727
+ 3+|[#key-prefix-image]*Key Prefix:* <<key-prefix-svg,svg>>
2728
+
2729
+ |fallback_font_family^[1]^
2730
+ |<<fonts,Font family name>> +
2731
+ (default: $base-font-family)
2732
+ |svg:
2733
+ fallback_font_family: Times-Roman
2734
+ |===
2735
+ . The fallback font family is only used when the font family in the SVG does not map to a known font name from the font catalog.
2736
+
2438
2737
  [#keys-lead]
2439
2738
  === Lead
2440
2739
 
@@ -3075,9 +3374,9 @@ The styling of the links is controlled by the global link styles.
3075
3374
 
3076
3375
  |font-size
3077
3376
  |<<values,Number>> +
3078
- (default: 8)
3377
+ (default: 9)
3079
3378
  |footnotes:
3080
- font-size: 6
3379
+ font-size: 8
3081
3380
 
3082
3381
  |font-style
3083
3382
  |<<font-styles,Font style>> +
@@ -3396,6 +3695,12 @@ To avoid this problem, reduce the height of the running content periphery or mak
3396
3695
  |header:
3397
3696
  text-transform: uppercase
3398
3697
 
3698
+ |title-style
3699
+ |document {vbar} toc {vbar} basic +
3700
+ (default: document)
3701
+ |header:
3702
+ title-style: toc
3703
+
3399
3704
  |vertical-align
3400
3705
  |top {vbar} middle {vbar} bottom +
3401
3706
  (default: middle)
@@ -3503,6 +3808,12 @@ To avoid this problem, reduce the height of the running content periphery or mak
3503
3808
  |footer:
3504
3809
  text-transform: uppercase
3505
3810
 
3811
+ |title-style
3812
+ |document {vbar} toc {vbar} basic +
3813
+ (default: document)
3814
+ |footer:
3815
+ title-style: toc
3816
+
3506
3817
  |vertical-align
3507
3818
  |top {vbar} middle {vbar} bottom +
3508
3819
  (default: middle)
@@ -3926,3 +4237,107 @@ For more information about source highlighting with Rouge, refer to the http://r
3926
4237
 
3927
4238
  * http://www.sitepoint.com/hackable-pdf-typesetting-in-ruby-with-prawn[Hackable PDF typesetting in Ruby with Prawn]
3928
4239
  ////
4240
+
4241
+ [appendix]
4242
+ == Preparing a Custom Font
4243
+
4244
+ Any TTF font can be used with Prawn--and hence Asciidoctor PDF--without modifications (unless, of course, it's corrupt or contains errors).
4245
+ However, you may discover that kerning is disabled and certain required glyphs are missing.
4246
+ To address these problems, you need to prepare the font using a font program such as {url-fontforge}[FontForge].
4247
+
4248
+ === Validate the Font
4249
+
4250
+ Before using the font, you may want to check that the font is valid.
4251
+ To do so, create the following script, which will verify that the TTF font is free from errors.
4252
+
4253
+ .validate-font.rb
4254
+ [source,ruby]
4255
+ ----
4256
+ require 'ttfunk'
4257
+ require 'ttfunk/subset_collection'
4258
+
4259
+ ttf_subsets = TTFunk::SubsetCollection.new TTFunk::File.open ARGV[0]
4260
+ (0...(ttf_subsets.instance_variable_get :@subsets).size).each {|idx| ttf_subsets[idx].encode }
4261
+ ----
4262
+
4263
+ Run the script on your font as follows:
4264
+
4265
+ $ ruby validate-font.rb path/to/font.ttf
4266
+
4267
+ If this script fails, the font will not work with Asciidoctor PDF.
4268
+ To repair it, open the font in FontForge and resave it using menu:File[Generate Fonts...,Generate].
4269
+ Dismiss any warning dialogs.
4270
+
4271
+ Resaving the font in FontForge will usually resolve any errors in the font.
4272
+ (If not, you may need to find another font, or at least another copy of it).
4273
+
4274
+ === Modifying the Font
4275
+
4276
+ To ready your font for use with Asciidoctor PDF, you'll need to modify it using a font program.
4277
+ We recommend using {url-fontforge}[FontForge].
4278
+ But don't let this scare you off.
4279
+ FontForge essentially works like a vector-drawing tool, in which each character is a separate canvas.
4280
+ You can find a crash course in how to use the program on the FontForge project site.
4281
+
4282
+ Here are the modifications you need to apply to a custom font for it to work best with Asciidoctor PDF:
4283
+
4284
+ * Convert the font to TTF (only required if the font is not already a TTF, such as an OTF or TTC).
4285
+ * Add the glyphs for the required characters if missing from the font (optional if using a falback font).
4286
+ * Subset the font to exclude unused characters to reduce the file size (optional).
4287
+ * Save the file using the old-style kern table to activate kerning.
4288
+
4289
+ NOTE: Technically, subsetting the font (i.e., removing glyphs) is not required since Prawn only embeds the characters from the font used in the document (i.e., it automatically subsets the font).
4290
+ However, if you plan to commit the font to a repository, subsetting helps keep the file size down.
4291
+
4292
+ Most fonts do not provide glyphs for all the Unicode character ranges (i.e., scripts).
4293
+ (A glyph is the corresponding vector image for a Unicode character).
4294
+ In fact, many fonts only include glyphs for Latin (Basic, Supplement, and Extended) and a few other scripts (e.g., Cyrillic, Greek).
4295
+ That means certain glyphs Asciidoctor PDF relies on may be missing from the font.
4296
+
4297
+ Below are are the non-Latin characters that Asciidoctor PDF uses (for which glyphs are often missing):
4298
+ Unless you're using a fallback font that fills in the missing glyphs, you need to ensure these glyphs are present in your font (and add them if not).
4299
+
4300
+ * \u00a0 - no-break space
4301
+ * \ufeff - zero width no-break space
4302
+ * \u200b - zero width space (used for line break hints)
4303
+ * \u000a - line feed character (zero width)
4304
+ * \u2009 - thin spaced (used in the button UI element)
4305
+ * \u202f - narrow no-break space (used in the keybinding UI element)
4306
+ * \u2011 - non-breaking hyphen
4307
+ * \u2022 - disc (used for first-level unordered list level)
4308
+ * \u25e6 - circle (used for second-level unordered list level)
4309
+ * \u25aa - square (used for third-level unordered list level)
4310
+ * \u2611 - ballot box checked (used for checked list item)
4311
+ * \u2610 - ballot box unchecked (used for unchecked list item)
4312
+ * \u2014 - em-dash (used in quote attribute)
4313
+ * \u203a - single right-pointing quotation mark (used in the menu UI element)
4314
+ * \u25ba - right pointer (used for media play icon when icon fonts are disabled)
4315
+
4316
+ If you're preparing a font for use in verbatim blocks (e.g., a listing block), you'll also need this range of characters:
4317
+
4318
+ * \u2460 to \u2468 - circled numbers
4319
+
4320
+ One way to get these glyphs is to steal them from another font (or from another character in the same font).
4321
+ To do so, open the other font in FontForge, select the character, press kbd:[Ctrl,c], switch back to your font, select the character again, and press kbd:[Ctrl,v].
4322
+ You may need to scale the glyph so it fits properly in the art box.
4323
+
4324
+ IMPORTANT: If you're copying a non-visible character, be sure to set the width to 0 using menu:Metrics[Set Width...], enter 0 into *Set Width To*, then click btn:[OK].
4325
+
4326
+ When you're done, save the font with the old-style kern table enabled.
4327
+ To do so, select menu:File[Generate Fonts...], click btn:[Options], and make sure only the following options are selected (equivalent to the flags 0x90 + 0x08):
4328
+
4329
+ * [x] OpenType
4330
+ ** [x] Old style 'kern'
4331
+
4332
+ Then click btn:[Generate] to generate and save the font.
4333
+
4334
+ Your font file is now ready to be used with Asciidoctor PDF.
4335
+
4336
+ === Scripting the Font Modifications
4337
+
4338
+ Performing all this font modification manually can be tedious (not to mention hard to reproduce).
4339
+ Fortunately, FontForge provides a {url-fontforge-scripting}[scripting interface], which you can use to automate the process.
4340
+
4341
+ In fact, that's what we use to prepare the fonts that are bundled with Asciidoctor PDF.
4342
+ You can find that FontForge script, the Bash script that calls it, and the Docker image in which it is run in the https://github.com/asciidoctor/asciidoctor-pdf/tree/master/scripts[scripts directory] of this project.
4343
+ You can use that script as a starting point or reference for your own font preparation / modification script.