lib/prawn/font/afm.rb in prawn-0.11.1.pre vs lib/prawn/font/afm.rb in prawn-0.11.1
- old
+ new
@@ -87,10 +87,13 @@
# is replaced with a string in WinAnsi encoding.
#
def normalize_encoding(text)
enc = Prawn::Encoding::WinAnsi.new
text.unpack("U*").collect { |i| enc[i] }.pack("C*")
+ rescue ArgumentError
+ raise Prawn::Errors::IncompatibleStringEncoding,
+ "Arguments to text methods must be UTF-8 encoded"
end
# Perform any changes to the string that need to happen
# before it is rendered to the canvas. Returns an array of
# subset "chunks", where each chunk is an array of two elements.
@@ -103,9 +106,17 @@
#
# The +text+ parameter must be in WinAnsi encoding (cp1252).
#
def encode_text(text, options={})
[[0, options[:kerning] ? kern(text) : text]]
+ end
+
+ def glyph_present?(char)
+ if char == "_"
+ true
+ else
+ normalize_encoding(char) != "_"
+ end
end
private
def register(subset)