Skip to content

Commit

Permalink
Merge pull request #17543 from opf/bug/60431-hyphenation-feature-in-g…
Browse files Browse the repository at this point in the history
…enerated-pdf-files-removes-space-before-italic-text

[#60431] Hyphenation feature in generated pdf files removes space before italic text
  • Loading branch information
ulferts authored Jan 8, 2025
2 parents df381fd + f48f1d4 commit d36b284
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/work_package/pdf_export/generator/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#++

require "md_to_pdf/core"
require "md_to_pdf/hyphen"

module WorkPackage::PDFExport::Generator::Generator
class MD2PDFGenerator
Expand Down Expand Up @@ -65,7 +66,7 @@ def generate!(markdown, options, image_loader)
.merge(@styles.default_fields)
.merge(options)
doc = parse_frontmatter_markdown(markdown, fields)
@hyphens = Text::Hyphen.new(language: options[:language], left: 2, right: 2) if options[:language].present?
@hyphens = Hyphen.new(options[:language], true) if options[:language].present?
render_doc(doc)
end

Expand All @@ -89,7 +90,7 @@ def image_url_to_local_file(url, _node = nil)
def hyphenate(text)
return text if @hyphens.nil?

@hyphens.visualize(text, Prawn::Text::SHY)
@hyphens.hyphenate(text)
end

def handle_mention_html_tag(tag, node, opts)
Expand Down

0 comments on commit d36b284

Please sign in to comment.