prawnpdf/prawn — pull request #743 by petesharum (2014-06-27 21:01:10+00:00)
Title: Don’t set font on fragments without font when processing fallback #263

The issue comes from the difference in how ```Prawn::Text::Formatted::Box``` and ```Prawn::Text``` handle styles. The fragments that are passed from ```Prawn::Text``` to ```Prawn::Text::Formatted::Box``` don't specify a font, relying on the font set on the document. After ```Prawn::Text::Formatted::Box#analyze_glyphs_for_fallback_support```, the fragments are rewritten with font families specified but no styles. This patch preserves the original (:font-less) state for resulting fragments that don't require fallback.

Example that reproduces the issue (starting from example in manual):

pdf_data = Prawn::Document.new do
fallback_fonts ["Times-Roman"]

["Courier", "Helvetica", "Times-Roman"].each do |example_font|
move_down 20

[:bold, :bold_italic, :italic, :normal].each do |style|
font example_font, :style => style do
text "I'm writing in #{example_font} (#{style})"
end
end
end
end

In this version, styles have no effect. Commenting ```fallback_fonts ["Times-Roman"]``` shows the styles working.