asciidoctor-pdf 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e90846d73d8139ce9e156f4010b8cd4220d9aa318897ec94dcac52ca2b027c61
4
- data.tar.gz: b519c77487cb7c7b317244342dcb06b40241d511016f6289e3a31b8305798225
3
+ metadata.gz: 71d676b5bc2fd2364a3e888aebe586cdb2d85ee259b23031409b5c919cd78ce3
4
+ data.tar.gz: 638470c38ac1fe4a7445c118c33c08768b6cfbee54f2435ba65158ee9423f9ee
5
5
  SHA512:
6
- metadata.gz: 836351139245d4460ea72c91889276e86484b1f587681ada048ccfa8d0716b7bfb595f28de0862e24556faec53a1b412a5d5f65cf2236b7579523dfd785dd1a6
7
- data.tar.gz: ae3ca4fbc60ab2f8b0eefab691c8c08dfc2e39f20a2950516a8f2c4d6f9a09420f3b702b063d160592d389d390834148ef14ad173b4b31a8432995b926c27b14
6
+ metadata.gz: 756f331bf5b74742739977ef159aa138743629a0fc91159767bb70994d7b939238bef3df1b2b05b8c58ed0ee837cdcd4153b531d132cd0ad31dc9b8e39ffc2e5
7
+ data.tar.gz: 34b9adfc79269f7936cb941056cda2303ec7e8e49f5c53772b3c92723b4d03ecace31ad9a5912e737b5c8fd84e855420b8169bf9d35500079df995e1de64b85d
@@ -5,6 +5,15 @@
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.3 (2020-02-28) - @mojavelinux
9
+
10
+ Bug Fixes::
11
+
12
+ * do not hyphen a hyphen when hyphenation is enabled (#1562)
13
+ * fix crash when applying text transform to heading cell in table body (#1575)
14
+ * honor font style when looking for glyph in font
15
+ * only suggest installing prawn-gmagick gem if not loaded (#1578)
16
+
8
17
  == 1.5.2 (2020-02-21) - @mojavelinux
9
18
 
10
19
  Bug Fixes::
@@ -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.2, 2020-02-21
3
+ v1.5.3, 2020-02-28
4
4
  // Settings:
5
5
  :experimental:
6
6
  :idprefix:
@@ -23,7 +23,7 @@ endif::[]
23
23
  :project-name: Asciidoctor PDF
24
24
  :project-handle: asciidoctor-pdf
25
25
  // Variables:
26
- :release-version: 1.5.2
26
+ :release-version: 1.5.3
27
27
  // URIs:
28
28
  :url-asciidoctor: http://asciidoctor.org
29
29
  :url-gem: http://rubygems.org/gems/asciidoctor-pdf
@@ -1527,7 +1527,7 @@ module Asciidoctor
1527
1527
  layout_caption node, category: :image, side: :bottom, block_align: alignment, block_width: rendered_w, max_width: @theme.image_caption_max_width if node.title?
1528
1528
  theme_margin :block, :bottom unless pinned
1529
1529
  rescue
1530
- on_image_error :exception, node, target, (opts.merge message: %(could not embed image: #{image_path}; #{$!.message}#{::Prawn::Errors::UnsupportedImageType === $! ? '; install prawn-gmagick gem to add support' : ''}))
1530
+ on_image_error :exception, node, target, (opts.merge message: %(could not embed image: #{image_path}; #{$!.message}#{::Prawn::Errors::UnsupportedImageType === $! && !(defined? ::GMagick::Image) ? '; install prawn-gmagick gem to add support' : ''}))
1531
1531
  end
1532
1532
  end
1533
1533
 
@@ -2040,7 +2040,7 @@ module Asciidoctor
2040
2040
  end
2041
2041
  unless cell_data.key? :content
2042
2042
  cell_text = cell.text.strip
2043
- cell_text = transform_text cell_text if cell_transform
2043
+ cell_text = transform_text cell_text, cell_transform if cell_transform
2044
2044
  cell_text = hyphenate_text cell_text, @hyphenator if defined? @hyphenator
2045
2045
  cell_text = cell_text.gsub CjkLineBreakRx, ZeroWidthSpace if @cjk_line_breaks
2046
2046
  if cell_text.include? LF
@@ -17,9 +17,32 @@ Prawn::Text::Formatted::Box.prepend (Module.new do
17
17
  end
18
18
  end
19
19
 
20
- def find_font_for_this_glyph char, current_font, fallback_fonts_to_check, original_font = current_font
21
- (doc = @document).font current_font
22
- if fallback_fonts_to_check.empty?
20
+ def analyze_glyphs_for_fallback_font_support fragment_hash
21
+ fragment_font = fragment_hash[:font] || (original_font = @document.font.family)
22
+ if (fragment_font_styles = fragment_hash[:styles])
23
+ if fragment_font_styles.include? :bold
24
+ fragment_font_opts = { style: (fragment_font_styles.include? :italic) ? :bold_italic : :bold }
25
+ elsif fragment_font_styles.include? :italic
26
+ fragment_font_opts = { style: :italic }
27
+ end
28
+ end
29
+ fallback_fonts = @fallback_fonts.dup
30
+ font_glyph_pairs = []
31
+ @document.save_font do
32
+ fragment_hash[:text].each_char do |char|
33
+ font_glyph_pairs << [(find_font_for_this_glyph char, fragment_font, fragment_font_opts || {}, fallback_fonts.dup), char]
34
+ end
35
+ end
36
+ # NOTE: don't add a :font to fragment if it wasn't there originally
37
+ font_glyph_pairs.each {|pair| pair[0] = nil if pair[0] == original_font } if original_font
38
+ form_fragments_from_like_font_glyph_pairs font_glyph_pairs, fragment_hash
39
+ end
40
+
41
+ def find_font_for_this_glyph char, current_font, current_font_opts = {}, fallback_fonts_to_check = [], original_font = current_font
42
+ (doc = @document).font current_font, current_font_opts
43
+ if doc.font.glyph_present? char
44
+ current_font
45
+ elsif fallback_fonts_to_check.empty?
23
46
  if logger.info? && !doc.scratch?
24
47
  fonts_checked = @fallback_fonts.dup.unshift original_font
25
48
  missing_chars = (doc.instance_variable_defined? :@missing_chars) ?
@@ -30,11 +53,9 @@ Prawn::Text::Formatted::Box.prepend (Module.new do
30
53
  previous_fonts_checked << fonts_checked
31
54
  end
32
55
  end
33
- current_font
34
- elsif doc.font.glyph_present? char
35
- current_font
56
+ original_font
36
57
  else
37
- find_font_for_this_glyph char, fallback_fonts_to_check.shift, fallback_fonts_to_check, original_font
58
+ find_font_for_this_glyph char, fallback_fonts_to_check.shift, current_font_opts, fallback_fonts_to_check, original_font
38
59
  end
39
60
  end
40
61
 
@@ -115,7 +115,7 @@ module Asciidoctor::PDF::FormattedText
115
115
  fragment[:image_width] = fragment[:width] = image_w
116
116
  fragment[:image_height] = image_h
117
117
  rescue
118
- logger.warn %(could not embed image: #{image_path}; #{$!.message}#{::Prawn::Errors::UnsupportedImageType === $! ? '; install prawn-gmagick gem to add support' : ''}) unless scratch
118
+ logger.warn %(could not embed image: #{image_path}; #{$!.message}#{::Prawn::Errors::UnsupportedImageType === $! && !(defined? ::GMagick::Image) ? '; install prawn-gmagick gem to add support' : ''}) unless scratch
119
119
  drop = true # delegate to cleanup logic in ensure block
120
120
  ensure
121
121
  # NOTE skip rendering image in scratch document or if image can't be loaded
@@ -17,7 +17,9 @@ module Asciidoctor
17
17
  PCDATAFilterRx = /(&#?[a-z\d]+;|<[^>]+>)|([^&<]+)/
18
18
  TagFilterRx = /(<[^>]+>)|([^<]+)/
19
19
  WordRx = /\S+/
20
+ Hyphen = '-'
20
21
  SoftHyphen = ?\u00ad
22
+ HyphenatedHyphen = '-' + SoftHyphen
21
23
 
22
24
  def capitalize_words_pcdata string
23
25
  if XMLMarkupRx.match? string
@@ -40,7 +42,7 @@ module Asciidoctor
40
42
  end
41
43
 
42
44
  def hyphenate_words string, hyphenator
43
- string.gsub(WordRx) { hyphenator.visualize $&, SoftHyphen }
45
+ string.gsub(WordRx) { (hyphenator.visualize $&, SoftHyphen).gsub HyphenatedHyphen, Hyphen }
44
46
  end
45
47
 
46
48
  def lowercase_pcdata string
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module PDF
5
- VERSION = '1.5.2'
5
+ VERSION = '1.5.3'
6
6
  end
7
7
  Pdf = PDF unless const_defined? :Pdf, false
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-02-21 00:00:00.000000000 Z
12
+ date: 2020-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: asciidoctor