[gentium-commits] [SCM] gentium updated: r108 - trunk/gentium/source/fonts/gentium-tug
Pavel Far??
INVALID.NOREPLY at gnu.org.ua
Sun May 8 19:16:57 CEST 2022
Author: pavel
Date: 2022-05-08 17:16:57 +0000 (Sun, 08 May 2022)
New Revision: 108
Modified:
trunk/gentium/source/fonts/gentium-tug/generate-support-files.rb
trunk/gentium/source/fonts/gentium-tug/gentium.rb
Log:
generate *.map files for GentiumBookPlus family
Needs testing if it really works (files in both "dvips" and "pdftex"
directories). The maps for Type 1 fonts are quite different from those
used for TrueType fonts.
Modified: trunk/gentium/source/fonts/gentium-tug/generate-support-files.rb
===================================================================
--- trunk/gentium/source/fonts/gentium-tug/generate-support-files.rb 2022-05-08 16:12:01 UTC (rev 107)
+++ trunk/gentium/source/fonts/gentium-tug/generate-support-files.rb 2022-05-08 17:16:57 UTC (rev 108)
@@ -54,3 +54,4 @@
# generate 'map' files
encodings.generate_maps(fontlist)
+encodings.generate_maps_book(fontlist_book)
Modified: trunk/gentium/source/fonts/gentium-tug/gentium.rb
===================================================================
--- trunk/gentium/source/fonts/gentium-tug/gentium.rb 2022-05-08 16:12:01 UTC (rev 107)
+++ trunk/gentium/source/fonts/gentium-tug/gentium.rb 2022-05-08 17:16:57 UTC (rev 108)
@@ -387,5 +387,68 @@
map_file_type1.close
map_file_ttf.close
end
+
+ # TODO: (Pavel) Merge methods "generate_maps" and "generate_maps_book"
+ def generate_maps_book(fontlist)
+ # initialize lines for map files, one array for each encoding
+ map_lines_type1 = Hash.new
+ map_lines_ttf = Hash.new
+ self.each_value do |encoding|
+ map_lines_type1[encoding.name] = Array.new
+ map_lines_ttf[encoding.name] = Array.new
+ end
+
+ # fill data
+ fontlist.each do |font|
+ self.each_value do |encoding|
+ # TODO: fix the last name (gentium) & encodings: this is another parameter that we have to introduce
+ name_tfm = "#{encoding.name}-#{font.filename_tex}".ljust(33)
+ line_reenc = "\"gentium-#{encoding.name}Encoding ReEncodeFont\"".ljust(42)
+ name_enc = "gentium-#{encoding.name}.enc"
+ name_enc_ttf = "gentium-#{encoding.name_truetype}.enc"
+
+ # normal
+ if font.is_plus? or encoding.has_bold? then
+ map_lines_type1[encoding.name].push("#{name_tfm} #{font.name_something.ljust(24)} #{line_reenc} <#{name_enc.ljust(24)} <#{font.filename_type1}")
+ map_lines_ttf[encoding.name].push("#{name_tfm} #{font.name_something.ljust(24)} <#{font.filename_ttf.ljust(18)} #{name_enc_ttf}")
+ end
+ # small caps
+ if font.is_plus? and encoding.has_smallcaps? then
+ name_tfm = "#{encoding.name}-#{font.filename_tex}-sc".ljust(33)
+ line_reenc = "\"gentium-#{encoding.name}scEncoding ReEncodeFont\"".ljust(42)
+ name_enc = "gentium-#{encoding.name}-sc.enc"
+ name_enc_ttf = "gentium-#{encoding.name_truetype_sc}.enc"
+
+ map_lines_type1[encoding.name].push("#{name_tfm} #{font.name_something.ljust(24)} #{line_reenc} <#{name_enc.ljust(24)} <#{font.filename_type1}")
+ map_lines_ttf[encoding.name].push("#{name_tfm} #{font.name_something.ljust(24)} <#{font.filename_ttf.ljust(18)} #{name_enc_ttf}")
+ end
+ end
+ end
+
+ # write map files into files
+ map_file_type1 = File.open(File.join($path_map, "gentiumbook-type1.map" ), 'w')
+ map_file_ttf = File.open(File.join($path_map_ttf, "gentiumbook-truetype.map"), 'w')
+ self.sort.map do |k,encoding|
+ # map file for Type1
+ map_lines_type1[encoding.name].each do |line|
+ map_file_type1.puts line
+ end
+ # map file fon TrueType
+ map_lines_ttf[encoding.name].each do |line|
+ map_file_ttf.puts line
+ end
+ # map file for TrueType for a single encoding (for ConTeXt)
+ # if encoding.is_used_in_context? then
+ if true then
+ File.open(File.join($path_map_ttf, "gentiumbook-#{encoding.name}.map"), 'w') do |map_file_enc|
+ map_lines_ttf[encoding.name].each do |line|
+ map_file_enc.puts line
+ end
+ end
+ end
+ end
+ map_file_type1.close
+ map_file_ttf.close
+ end
end
More information about the gentium-commits
mailing list.