lib/ttfunk/table/name.rb in ttfunk-1.6.2.1 vs lib/ttfunk/table/name.rb in ttfunk-1.7.0

- old
+ new

@@ -74,24 +74,25 @@ "#{tag}+#{names.postscript_name}", 1, 0, 0 ) strings = names.strings.dup strings[6] = [postscript_name] - str_count = strings.inject(0) { |sum, (_, list)| sum + list.length } + str_count = strings.reduce(0) { |sum, (_, list)| sum + list.length } table = [0, str_count, 6 + 12 * str_count].pack('n*') strtable = +'' items = [] strings.each do |id, list| list.each do |string| items << [id, string] end end - items = items.sort_by do |id, string| - [string.platform_id, string.encoding_id, string.language_id, id] - end + items = + items.sort_by do |id, string| + [string.platform_id, string.encoding_id, string.language_id, id] + end items.each do |id, string| table << [ string.platform_id, string.encoding_id, string.language_id, id, string.length, strtable.length ].pack('n*') @@ -149,10 +150,10 @@ @font_name = @strings[FONT_NAME_NAME_ID] @version = @strings[VERSION_NAME_ID] unless @strings[POSTSCRIPT_NAME_NAME_ID].empty? @postscript_name = @strings[POSTSCRIPT_NAME_NAME_ID] - .first.strip_extended + .first.strip_extended end @trademark = @strings[TRADEMARK_NAME_ID] @manufacturer = @strings[MANUFACTURER_NAME_ID] @designer = @strings[DESIGNER_NAME_ID]