Skip to content

Commit

Permalink
don't crash if the PDF incorrectly uses vertical mode
Browse files Browse the repository at this point in the history
(found example of pdf that used vertical mode with
a font that didn't support vertical mode)
  • Loading branch information
babymastodon committed Jan 24, 2013
1 parent bdf3a0e commit fb84383
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/pdf/reader/width_calculator/built_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ def glyph_width(code_point)
m ? m[:wx] : 0
end

#TODO: no idea why my pdf is using a built-in font in
#vertical writing mode. Couldn't find anything in the
#spec that described the desired behavior in this case.
def glyph_height(code_point)
return 0
end

end
end
end
7 changes: 7 additions & 0 deletions lib/pdf/reader/width_calculator/true_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ def glyph_width_from_descriptor(code_point)
nil
end
end

#TODO: figure out the proper response when the pdf
#tries to write in vertical mode with this font
#(which doesn't support vertical mode)
def glyph_height(code_point)
return 0
end
end
end
end
Expand Down
7 changes: 7 additions & 0 deletions lib/pdf/reader/width_calculator/type_one_or_three.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ def glyph_width(code_point)
@missing_width.to_f
end
end

#TODO: figure out the proper response when the pdf
#tries to write in vertical mode with this font
#(which doesn't support vertical mode)
def glyph_height(code_point)
return 0
end
end
end
end

0 comments on commit fb84383

Please sign in to comment.