diff options
Diffstat (limited to 'fonts/gentium-tug/source')
20 files changed, 1610 insertions, 0 deletions
diff --git a/fonts/gentium-tug/source/ChangeLog b/fonts/gentium-tug/source/ChangeLog new file mode 100644 index 0000000000..dcaf0b8458 --- /dev/null +++ b/fonts/gentium-tug/source/ChangeLog @@ -0,0 +1,10 @@ +2019-07-09 Karl Berry <karl@freefriends.org> + + * gentium-lgr.lig (|| cwm): change from 0 to cwm to make + sigma + boundary char result in a final sigma. + (sigma quoteright asterisk, slash, colon, bracketright): sigma1. + From Ralf Stubner. + https://tug.org/pipermail/gentium/2019q3/000022.html (thread) + https://tug.org/pipermail/gentium/2019q3/000030.html + +(This file public domain.) diff --git a/fonts/gentium-tug/source/Makefile b/fonts/gentium-tug/source/Makefile new file mode 100644 index 0000000000..5c081a6223 --- /dev/null +++ b/fonts/gentium-tug/source/Makefile @@ -0,0 +1,47 @@ +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. +# +# Here is just a way to record the commands to test the new boundary +# ligatures to automatically make the final sigma with the lgr encoding. +# From Ralf Stubner, July 2019. + +fontdir = ../../../fonts +tfmdir = $(fontdir)/tfm/public/gentium-tug + +default: try-ital + +# the diff should show differences, hence exit nonzero. +try-reg: lgr-gentiumplus-regular.pl + afm2pl -p $(fontdir)/enc/dvips/gentium-tug/gentium-lgr.enc \ + -l lig/gentium-lgr.lig \ + $(fontdir)/afm/public/gentium-tug/GentiumPlus-R.afm \ + && pltotf GentiumPlus-R \ + && tftopl GentiumPlus-R GentiumPlus-R \ + && ! diff -u lgr-gentiumplus-regular.pl GentiumPlus-R.pl +# +# clearly this could all be factored out, but maybe we will never touch +# this stuff again, so ... +try-ital: lgr-gentiumplus-italic.pl + afm2pl -p $(fontdir)/enc/dvips/gentium-tug/gentium-lgr.enc \ + -l lig/gentium-lgr.lig \ + $(fontdir)/afm/public/gentium-tug/GentiumPlus-I.afm \ + && pltotf GentiumPlus-I \ + && tftopl GentiumPlus-I GentiumPlus-I \ + && ! diff -u lgr-gentiumplus-italic.pl GentiumPlus-I.pl + +# the original pl's, for comparison. +lgr-gentiumplus-regular.pl: + tftopl $(tfmdir)/lgr-gentiumplus-regular $@ || rm -f $@ +lgr-gentiumplus-italic.pl: + tftopl $(tfmdir)/lgr-gentiumplus-italic $@ || rm -f $@ + +# dist just copies the working directory, so have to install and clean. +install: + mv GentiumPlus-R.tfm $(tfmdir)/lgr-gentiumplus-regular.tfm + mv GentiumPlus-I.tfm $(tfmdir)/lgr-gentiumplus-italic.tfm + +clean: + rm -f GentiumPlus-* lgr-gent*.pl + +dist: clean + ./make-zip-4CTAN.sh diff --git a/fonts/gentium-tug/source/generate-support-files.rb b/fonts/gentium-tug/source/generate-support-files.rb new file mode 100755 index 0000000000..97c16a1b0a --- /dev/null +++ b/fonts/gentium-tug/source/generate-support-files.rb @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. + +require 'gentium' + +# encodings +encodings = EncodingSet.new +[ "ot1", "ec", "texnansi", "l7x", "qx", "t5", "ts1" ].each do |enc| + encodings[enc] = Encoding.new(enc, true) # name, supported_by_basic +end +[ "t2a", "t2b", "t2c", "x2", "agr", "lgr" ].each do |enc| + encodings[enc] = Encoding.new(enc, false) # name, supported_by_basic +end + +# fonts +font_gentiumplus_rm = Font.new("GentiumPlus-R", "GentiumPlus-Regular", "gentiumplus-regular") +font_gentiumplus_it = Font.new("GentiumPlus-I", "GentiumPlus-Italic", "gentiumplus-italic") +font_gentiumbasic_bf = Font.new("GenBasB", "GentiumBasic-Bold", "gentiumbasic-bold") +font_gentiumbasic_bi = Font.new("GenBasBI", "GentiumBasic-BoldItalic", "gentiumbasic-bolditalic") +fontlist = [font_gentiumplus_rm, font_gentiumplus_it, font_gentiumbasic_bf, font_gentiumbasic_bi] + + +encodings.each_value do |encoding| + # generate 'enc' files for small caps + if encoding.has_smallcaps? then + # font_gentiumplus_rm is needed to check for glyph names + encoding.generate_enc_sc(font_gentiumplus_rm) + end + + # generate 'fd' files + if encoding.is_used_in_latex? then + encoding.generate_fd + end + + # generate 'tfm' files + fontlist.each do |font| + font.generate_tfms(encoding) + end + +end + +# generate 'map' files +encodings.generate_maps(fontlist) diff --git a/fonts/gentium-tug/source/gentium.rb b/fonts/gentium-tug/source/gentium.rb new file mode 100644 index 0000000000..9f68654fd9 --- /dev/null +++ b/fonts/gentium-tug/source/gentium.rb @@ -0,0 +1,384 @@ +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. + +require 'fileutils' + +$TDS_ROOT = File.expand_path('../../../') +$package_name = "gentium-tug" + +$path_source = File.join($TDS_ROOT, "source", "fonts", $package_name) +$path_ttf = File.join($TDS_ROOT, "fonts", "truetype", "public", $package_name) +$path_type1 = File.join($TDS_ROOT, "fonts", "type1", "public", $package_name) +$path_tfm = File.join($TDS_ROOT, "fonts", "tfm", "public", $package_name) +$path_afm = File.join($TDS_ROOT, "fonts", "afm", "public", $package_name) +$path_map_ttf = File.join($TDS_ROOT, "fonts", "map", "pdftex", $package_name) +$path_map = File.join($TDS_ROOT, "fonts", "map", "dvips", $package_name) +$path_enc = File.join($TDS_ROOT, "fonts", "enc", "dvips", $package_name) +$path_fd = File.join($TDS_ROOT, "tex", "latex", $package_name) +$path_tmp = File.join($TDS_ROOT, "tmp") + +class Font + def initialize(filename, name_something, filename_tex) + @filename = filename + @filename_tex = filename_tex + @name_something = name_something # TODO + if filename =~ /Plus/ then + @is_plus = true + else + @is_plus = false + end + end + def is_plus? + return @is_plus + end + + def filename_ttf + return "#{@filename}.ttf" + end + def filename_type1 + return "#{@filename}.pfb" + end + def filename_afm + return "#{@filename}.afm" + end + def filename_pl + return "#{@filename}.pl" + end + + def generate_type1_with_ttf2pt1 + puts "#" + puts "# generating type1 version of #{@filename}" + puts "#" + pwd = Dir.pwd() + Dir.chdir($path_ttf) + command = "ttf2pt1 -a -b #{filename_ttf}" + puts "> #{command}" + if system(command) then + if File.exists?(filename_type1) then + File.rename(filename_type1, File.join($path_type1, filename_type1)) + else + stderr.puts "ERROR: '#{filename_type1}' doesn't exist" + end + if File.exists?(filename_afm) then + File.rename(filename_afm, File.join($path_afm, filename_afm)) + else + stderr.puts "ERROR: '#{filename_afm}' doesn't exist" + end + end + Dir.chdir(pwd) + end + + def generate_type1 + generate_type1_with_ttf2pt1 + end + + def generate_tfms(encoding) + # normal + if is_plus? or encoding.has_bold? then + generate_tfm(encoding, false) + end + # small caps + if is_plus? and encoding.has_smallcaps? then + generate_tfm(encoding, true) + end + end + + def generate_tfm(encoding, smallcaps) + pwd = Dir.pwd + Dir.chdir($path_afm) + smcp = "" + if smallcaps then + smcp = "-sc" + end + puts "#" + puts "# Generating TFM file for font \"#{filename}\" in encoding \"#{encoding.name}#{smcp}\"" + puts "#" + filename_enc = "gentium-#{encoding.name}#{smcp}.enc" + filename_map = "#{filename}.map" + filename_pl_new = "#{encoding.name}-#{filename_tex}#{smcp}.pl" + filename_tfm = "#{encoding.name}-#{filename_tex}#{smcp}.tfm" + filename_lig = File.join(pwd, "lig", "gentium-#{encoding.name}#{smcp}.lig") + + # temporarily copy encoding file to current directory (absolute paths don't seem to work) + FileUtils.cp(File.join($path_enc, filename_enc), filename_enc) + # File.copy(File.join($path_enc, filename_enc), filename_enc) + if File.exists?(filename_lig) then + command = "afm2pl -p #{filename_enc} -l #{filename_lig} #{filename_afm}" + else + command = "afm2pl -p #{filename_enc} #{filename_afm}" + end + puts "> #{command}" + system(command) + # output = `#{command}` + # if $?.success? then + if File.exists?(filename_pl) then + File.rename(filename_pl, filename_pl_new) + command2 = "pltotf #{filename_pl_new}" + puts "> #{command2}" + if system(command2) then + if File.exists?(filename_tfm) then + File.rename(filename_tfm, File.join($path_tfm, filename_tfm)) + else + $stderr.puts "ERROR: '#{filename_tfm}' doesn't exist" + end + else + $stderr.puts "ERROR: unable to run #{command2}" + end + else + $stderr.puts "ERROR: '#{filename_pl}' doesn't exist" + end + # else + # $stderr.puts "ERROR: unable to run '#{command}'" + # puts output + # end + File.delete(filename_pl_new) + File.delete(filename_enc) + # afm2pl creates filename.map that has to be removed + File.delete(filename_map) + + Dir.chdir(pwd) + # puts " I'm now at #{Dir.pwd}" + end + + def glyph_names + if @glyph_names_hash == nil then + @glyph_names_hash = Hash.new + File.open(File.join($path_afm, filename_afm)).each_line.grep(/^C .*?; N ([^\s]*)/) do |line| + name = $1 + @glyph_names_hash[name] = true + # puts line + end + end + + return @glyph_names_hash + end + + attr_reader :filename, :filename_tex, :name_something +end + +class FontSet + def initialize(font_rm, font_it, font_bf, font_bi) + @rm = font_rm + @it = font_it + @bf = font_bf + @bi = font_bi + @list = [font_rm, font_it, font_bf, font_bi] + end + def each + @list.each { |f| if f then yield f end } + end +end + +class Encoding + def initialize(name, supported_by_basic_family) + @name = name + @supported_by_basic_family = supported_by_basic_family + end + def to_s + @name + end + def name_context + return @name + end + def name_latex + if @name == "ec" then + return "t1" + elsif @name == "texnansi" then + return "ly1" + else + return @name + end + end + def name_latex_uppercase + if @name == "l7x" then + return "L7x" + else + return name_latex.upcase + end + end + def name_truetype + if ["ec", "t5"].include?(@name) then + return "#{@name}-ttf" + else + return @name + end + end + def name_truetype_sc + if @name == "ec" then + return "#{@name}-ttf-sc" + else + return "#{@name}-sc" + end + end + + def is_used_in_context? + if ["ot1", "ts1", "lgr", "t2b", "t2c", "x2"].include?(@name) then + return false + else + return true + end + end + def is_used_in_latex? + if ["agr"].include?(@name) then + return false + else + return true + end + end + def has_bold? + return @supported_by_basic_family + end + def has_smallcaps? + if ["ts1", "agr", "lgr"].include?(@name) then + return false + else + return true + end + end + + def generate_enc_sc(font) + file_enc_new = File.open(File.join($path_enc, "gentium-#{@name}-sc.enc"), 'w') + File.open(File.join($path_enc, "gentium-#{@name}.enc")).each_line do |line| + if line =~ /Encoding/ then + file_enc_new.puts line.gsub(/Encoding/, "scEncoding") + elsif line =~ /^\/([^\s%]*)/ then + name = $1 + name_sc = "#{name}.sc" + if not font.glyph_names[name] then + puts "Warning: glyph '#{name}' in in encoding '#{@name}' doesn't exist." + end + if name == "uni0237" then + name_sc = "j.sc" + end + if font.glyph_names[name_sc] then + file_enc_new.puts "/#{name_sc}" + elsif ["ff", "fi", "ffi", "fl", "ffl"].include?(name) then + file_enc_new.puts "/.notdef" + else + file_enc_new.puts "/#{name}" + end + else + file_enc_new.puts line + end + end + file_enc_new.close + end + + def declare_font_shape(width, shape, name) + text = "\\DeclareFontShape{#{name_latex_uppercase}}{gentium}{#{width}}{#{shape}}{\n" + + " <-> \\gentium@@scale #{@name}-gentium#{name}\n" + + "}{}\n\n" + return text + end + def declare_font_shape_sub(width1, shape1, width2, shape2) + return "\\DeclareFontShape{#{name_latex_uppercase}}{gentium}{#{width1}}{#{shape1}}{<->ssub * gentium/#{width2}/#{shape2}}{}" + end + def generate_fd + date = "2012/02/06" + date = "2011/01/13" + + filename = "#{name_latex}gentium.fd" + File.open(File.join($path_fd,filename), 'w') do |file| + file.puts "\\ProvidesFile{#{name_latex}gentium.fd}" + file.puts " [#{date} Font definitions for gentium.]" + file.puts + file.puts '\expandafter\ifx\csname gentium@scale\endcsname\relax' + file.puts ' \let\gentium@@scale\@empty' + file.puts '\else' + file.puts ' \edef\gentium@@scale{s*[\csname gentium@scale\endcsname]}%' + file.puts '\fi' + file.puts + file.puts "\\DeclareFontFamily{#{name_latex_uppercase}}{gentium}{}" + file.puts + file.puts declare_font_shape("m", "n", "plus-regular") + file.puts declare_font_shape("m", "it", "plus-italic") + if has_bold? then + file.puts declare_font_shape("b", "n", "basic-bold") + file.puts declare_font_shape("b", "it", "basic-bolditalic") + # TODO: set the correct tfm names in the following two lines + if has_smallcaps? then + file.puts declare_font_shape("m", "sc", "plus-regular-sc") + file.puts declare_font_shape("m", "scit", "plus-italic-sc") + end + # TODO: a clever algorithm to do replacements instead + file.puts declare_font_shape_sub("m", "sl", "m", "it") + file.puts declare_font_shape_sub("b", "sl", "b", "it") + file.puts declare_font_shape_sub("bx", "sl", "b", "it") + file.puts declare_font_shape_sub("bx", "it", "b", "it") + file.puts declare_font_shape_sub("bx", "n", "b", "n") + else + file.puts declare_font_shape_sub("m", "sl", "m", "it") + end + file.puts + file.puts '\endinput' + end + end + + attr_reader :name +end + +class EncodingSet < Hash + + def generate_maps(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, "gentium-type1.map" ), 'w') + map_file_ttf = File.open(File.join($path_map_ttf, "gentium-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, "gentium-#{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 + diff --git a/fonts/gentium-tug/source/lig/README b/fonts/gentium-tug/source/lig/README new file mode 100644 index 0000000000..e1b05b8506 --- /dev/null +++ b/fonts/gentium-tug/source/lig/README @@ -0,0 +1,3 @@ +The ligature support files in this directory are part of the Gentium +package for TeX. They are licensed under the Expat License, see +doc//README for details. diff --git a/fonts/gentium-tug/source/lig/gentium-agr.lig b/fonts/gentium-tug/source/lig/gentium-agr.lig new file mode 100644 index 0000000000..dd5207d42c --- /dev/null +++ b/fonts/gentium-tug/source/lig/gentium-agr.lig @@ -0,0 +1,45 @@ +|| = cwm ; + + +hyphen hyphen =: endash ; endash hyphen =: emdash ; +parenleft parenleft =: quotedblleft ; parenright parenright =: quotedblright ; +dieresis iota =: iotadieresis ; dieresis upsilon =: upsilondieresis ; dieresis uni1FC0 =: uni1FC1 ; dieresis guilsinglleft =: uni1FED ; dieresis guilsinglright =: uni1FEE ; +guilsinglright guilsinglright =: quoteright ; guilsinglright alpha =: uni1F71 ; guilsinglright epsilon =: uni1F73 ; guilsinglright iota =: uni1F77 ; guilsinglright || =:| quoteright ; +guilsinglright eta =: uni1F75 ; guilsinglright omicron =: uni1F79 ; guilsinglright upsilon =: uni1F7B ; guilsinglright omega =: uni1F7D ; +uni1FFE guilsinglright =: uni1FDE ; uni1FFE guilsinglleft =: uni1FDD ; uni1FFE uni1FC0 =: uni1FDF ; +uni1FFE alpha =: uni1F01 ; uni1FFE epsilon =: uni1F11 ; uni1FFE eta =: uni1F21 ; uni1FFE iota =: uni1F31 ; +uni1FFE omicron =: uni1F41 ; uni1FFE upsilon =: uni1F51 ; uni1FFE omega =: uni1F61 ; uni1FFE rho =: uni1FE5 ; +uni1FBF guilsinglright =: uni1FCE ; uni1FBF guilsinglleft =: uni1FCD ; uni1FBF uni1FC0 =: uni1FCF ; +uni1FBF alpha =: uni1F00 ; uni1FBF epsilon =: uni1F10 ; uni1FBF eta =: uni1F20 ; uni1FBF iota =: uni1F30 ; +uni1FBF omicron =: uni1F40 ; uni1FBF upsilon =: uni1F50 ; uni1FBF omega =: uni1F60 ; uni1FBF rho =: uni1FE4 ; +alpha bar =: uni1FB3 ; +eta bar =: uni1FC3 ; +omega bar =: uni1FF3 ; +guilsinglleft alpha =: uni1F70 ; guilsinglleft epsilon =: uni1F72 ; guilsinglleft iota =: uni1F76 ; +guilsinglleft eta =: uni1F74 ; guilsinglleft omicron =: uni1F78 ; guilsinglleft upsilon =: uni1F7A ; guilsinglleft omega =: uni1F7C ; +uni1FC0 alpha =: uni1FB6 ; uni1FC0 iota =: uni1FD6 ; +uni1FC0 eta =: uni1FC6 ; uni1FC0 upsilon =: uni1FE6 ; uni1FC0 omega =: uni1FF6 ; +uni1FDF alpha =: uni1F07 ; uni1FDF iota =: uni1F37 ; +uni1FDF eta =: uni1F27 ; uni1FDF upsilon =: uni1F57 ; uni1FDF omega =: uni1F67 ; +uni1FCF alpha =: uni1F06 ; uni1FCF iota =: uni1F36 ; +uni1FCF eta =: uni1F26 ; uni1FCF upsilon =: uni1F56 ; uni1FCF omega =: uni1F66 ; +uni1FDE alpha =: uni1F05 ; uni1FDE epsilon =: uni1F15 ; uni1FDE iota =: uni1F35 ; +uni1FDE eta =: uni1F25 ; uni1FDE omicron =: uni1F45 ; uni1FDE upsilon =: uni1F55 ; uni1FDE omega =: uni1F65 ; +uni1FCE alpha =: uni1F04 ; uni1FCE epsilon =: uni1F14 ; uni1FCE iota =: uni1F34 ; +uni1FCE eta =: uni1F24 ; uni1FCE omicron =: uni1F44 ; uni1FCE upsilon =: uni1F54 ; uni1FCE omega =: uni1F64 ; +uni1FDD alpha =: uni1F03 ; uni1FDD epsilon =: uni1F13 ; uni1FDD iota =: uni1F33 ; +uni1FDD eta =: uni1F23 ; uni1FDD omicron =: uni1F43 ; uni1FDD upsilon =: uni1F53 ; uni1FDD omega =: uni1F63 ; +uni1FCD alpha =: uni1F02 ; uni1FCD epsilon =: uni1F12 ; uni1FCD iota =: uni1F32 ; +uni1FCD eta =: uni1F22 ; uni1FCD omicron =: uni1F42 ; uni1FCD upsilon =: uni1F52 ; uni1FCD omega =: uni1F62 ; +uni1FEE iota =: uni1FD3 ; uni1FEE upsilon =: uni1FE3 ; +uni1FED iota =: uni1FD2 ; uni1FED upsilon =: uni1FE2 ; +uni1FC1 iota =: uni1FD7 ; uni1FC1 upsilon =: uni1FE7 +uni1F01 bar =: uni1F81 ; uni1F00 bar =: uni1F80 ; uni1F71 bar =: uni1FB4 ; uni1F05 bar =: uni1F85 ; uni1F04 bar =: uni1F84 ; uni1F70 bar =: uni1FB2 ; +uni1F70 bar =: uni1FB2 ; uni1F03 bar =: uni1F83 ; uni1F02 bar =: uni1F82 ; uni1FB6 bar =: uni1FB7 ; uni1F07 bar =: uni1F87 ; uni1F71 bar =: uni1FB4 ; +uni1F06 bar =: uni1F86 ; +uni1F21 bar =: uni1F91 ; uni1F20 bar =: uni1F90 ; uni1F71 bar =: uni1FB4 ; uni1F25 bar =: uni1F95 ; uni1F24 bar =: uni1F94 ; uni1F74 bar =: uni1FC2 ; +uni1F70 bar =: uni1FB2 ; uni1F23 bar =: uni1F93 ; uni1F22 bar =: uni1F92 ; uni1FB6 bar =: uni1FB7 ; uni1F27 bar =: uni1F97 ; uni1F75 bar =: uni1FC4 ; uni1FC6 bar =: uni1FC7 +uni1F26 bar =: uni1F96 ; +uni1F61 bar =: uni1FA1 ; uni1F60 bar =: uni1FA0 ; uni1F71 bar =: uni1FB4 ; uni1F65 bar =: uni1FA5 ; uni1F64 bar =: uni1FA4 ; uni1F7C bar =: uni1FF2 ; uni1FF6 bar =: uni1FF7 ; +uni1F70 bar =: uni1FB2 ; uni1F63 bar =: uni1FA3 ; uni1F62 bar =: uni1FA2 ; uni1FB6 bar =: uni1FB7 ; uni1F67 bar =: uni1FA7 ; uni1F7D bar =: uni1FF4 ; +uni1F66 bar =: uni1FA6 ; diff --git a/fonts/gentium-tug/source/lig/gentium-lgr.lig b/fonts/gentium-tug/source/lig/gentium-lgr.lig new file mode 100644 index 0000000000..0e7dfb2ca6 --- /dev/null +++ b/fonts/gentium-tug/source/lig/gentium-lgr.lig @@ -0,0 +1,165 @@ +% LIGKERN || = cwm ; + +% LIGKERN sigma || =:| sigma1 ; sigma guillemotright =:| sigma1 ; +% LIGKERN sigma parenright =:| sigma1 ; sigma period =:| sigma1 ; +% LIGKERN sigma comma =:| sigma1 ; sigma exclam =:| sigma1 ; +% LIGKERN sigma semicolon =:| sigma1 ; sigma anoteleia =:| sigma1 ; +% LIGKERN sigma quoteright =:| sigma1 ; sigma asterisk =:| sigma1 ; +% LIGKERN sigma slash =:| sigma1 ; sigma colon =:| sigma1 ; +% LIGKERN sigma bracketright =:| sigma1 ; + +% LIGKERN hyphen hyphen =: endash ; endash hyphen =: emdash ; +% LIGKERN parenleft parenleft =: guillemotleft ; +% LIGKERN parenright parenright =: guillemotright ; + +% LIGKERN uni1FBF tonos =: uni1FCE ; +% LIGKERN uni1FBF uni1FEF =: uni1FCD ; +% LIGKERN uni1FBF tilde =: uni1FCF ; +% LIGKERN uni1FBF alpha =: uni1F00 ; +% LIGKERN uni1FBF epsilon =: uni1F10 ; +% LIGKERN uni1FBF eta =: uni1F20 ; +% LIGKERN uni1FBF iota =: uni1F30 ; +% LIGKERN uni1FBF omicron =: uni1F40 ; +% LIGKERN uni1FBF upsilon =: uni1F50 ; +% LIGKERN uni1FBF omega =: uni1F60 ; +% LIGKERN uni1FBF rho =: uni1FE4 ; + +% LIGKERN uni1FFE tonos =: uni1FDE ; +% LIGKERN uni1FFE uni1FEF =: uni1FDD ; +% LIGKERN uni1FFE tilde =: uni1FDF ; +% LIGKERN uni1FFE alpha =: uni1F01 ; +% LIGKERN uni1FFE epsilon =: uni1F11 ; +% LIGKERN uni1FFE eta =: uni1F21 ; +% LIGKERN uni1FFE iota =: uni1F31 ; +% LIGKERN uni1FFE omicron =: uni1F41 ; +% LIGKERN uni1FFE upsilon =: uni1F51 ; +% LIGKERN uni1FFE omega =: uni1F61 ; +% LIGKERN uni1FFE rho =: uni1FE5 ; + +% LIGKERN uni1FCD alpha =: uni1F02 ; +% LIGKERN uni1FCD epsilon =: uni1F12 ; +% LIGKERN uni1FCD eta =: uni1F22 ; +% LIGKERN uni1FCD iota =: uni1F32 ; +% LIGKERN uni1FCD omicron =: uni1F42 ; +% LIGKERN uni1FCD upsilon =: uni1F52 ; +% LIGKERN uni1FCD omega =: uni1F62 ; + +% LIGKERN uni1FDD alpha =: uni1F03 ; +% LIGKERN uni1FDD epsilon =: uni1F13 ; +% LIGKERN uni1FDD eta =: uni1F23 ; +% LIGKERN uni1FDD iota =: uni1F33 ; +% LIGKERN uni1FDD omicron =: uni1F43 ; +% LIGKERN uni1FDD upsilon =: uni1F53 ; +% LIGKERN uni1FDD omega =: uni1F63 ; + +% LIGKERN uni1FCE alpha =: uni1F04 ; +% LIGKERN uni1FCE epsilon =: uni1F14 ; +% LIGKERN uni1FCE eta =: uni1F24 ; +% LIGKERN uni1FCE iota =: uni1F34 ; +% LIGKERN uni1FCE omicron =: uni1F44 ; +% LIGKERN uni1FCE upsilon =: uni1F54 ; +% LIGKERN uni1FCE omega =: uni1F64 ; + +% LIGKERN uni1FDE alpha =: uni1F05 ; +% LIGKERN uni1FDE epsilon =: uni1F15 ; +% LIGKERN uni1FDE eta =: uni1F25 ; +% LIGKERN uni1FDE iota =: uni1F35 ; +% LIGKERN uni1FDE omicron =: uni1F45 ; +% LIGKERN uni1FDE upsilon =: uni1F55 ; +% LIGKERN uni1FDE omega =: uni1F65 ; + +% LIGKERN uni1FCF alpha =: uni1F06 ; +% LIGKERN uni1FCF eta =: uni1F26 ; +% LIGKERN uni1FCF iota =: uni1F36 ; +% LIGKERN uni1FCF upsilon =: uni1F56 ; +% LIGKERN uni1FCF omega =: uni1F66 ; + +% LIGKERN uni1FDF alpha =: uni1F07 ; +% LIGKERN uni1FDF eta =: uni1F27 ; +% LIGKERN uni1FDF iota =: uni1F37 ; +% LIGKERN uni1FDF upsilon =: uni1F57 ; +% LIGKERN uni1FDF omega =: uni1F67 ; + +% LIGKERN tilde uni1FBF =: uni1FCF ; +% LIGKERN tilde uni1FFE =: uni1FDF ; +% LIGKERN dieresis tilde =: uni1FC1 ; +% LIGKERN tilde dieresis =: uni1FC1 ; +% LIGKERN tilde alpha =: uni1FB6 ; +% LIGKERN tilde eta =: uni1FC6 ; +% LIGKERN tilde iota =: uni1FD6 ; +% LIGKERN tilde upsilon =: uni1FE6 ; +% LIGKERN tilde omega =: uni1FF6 ; + +% LIGKERN uni1FEF dieresis =: uni1FED ; +% LIGKERN uni1FEF alpha =: uni1F70 ; +% LIGKERN uni1FEF epsilon =: uni1F72 ; +% LIGKERN uni1FEF eta =: uni1F74 ; +% LIGKERN uni1FEF iota =: uni1F76 ; +% LIGKERN uni1FEF omicron =: uni1F78 ; +% LIGKERN uni1FEF upsilon =: uni1F7A ; +% LIGKERN uni1FEF omega =: uni1F7C ; + +% LIGKERN tonos dieresis =: dieresistonos +% LIGKERN tonos tonos =: quoteright ; uni1FEF uni1FEF =: quoteleft ; +% LIGKERN tonos alpha =: alphatonos ; +% LIGKERN tonos epsilon =: epsilontonos ; +% LIGKERN tonos eta =: etatonos ; +% LIGKERN tonos iota =: iotatonos ; +% LIGKERN tonos omicron =: omicrontonos ; +% LIGKERN tonos upsilon =: upsilontonos ; +% LIGKERN tonos omega =: omegatonos ; + +% LIGKERN dieresis uni1FEF =: uni1FED ; +% LIGKERN dieresis iota =: iotadieresis ; dieresis Iota =: Iotadieresis ; +% LIGKERN dieresis upsilon =: upsilondieresis ; +% LIGKERN dieresis Upsilon =: Upsilondieresis ; +% LIGKERN dieresistonos iota =: iotadieresistonos ; +% LIGKERN dieresistonos upsilon =: upsilondieresistonos ; +% LIGKERN dieresis tonos =: dieresistonos + +% LIGKERN Alpha uni1FBE |=: iota ; +% LIGKERN Eta uni1FBE |=: iota ; +% LIGKERN Omega uni1FBE |=: iota ; + +% LIGKERN alpha uni1FBE =: uni1FB3 ; +% LIGKERN alphatonos uni1FBE =: uni1FB4 ; +% LIGKERN uni1F00 uni1FBE =: uni1F80 ; +% LIGKERN uni1F01 uni1FBE =: uni1F81 ; +% LIGKERN uni1F02 uni1FBE =: uni1F82 ; +% LIGKERN uni1F03 uni1FBE =: uni1F83 ; +% LIGKERN uni1F04 uni1FBE =: uni1F84 ; +% LIGKERN uni1F05 uni1FBE =: uni1F85 ; +% LIGKERN uni1F06 uni1FBE =: uni1F86 ; +% LIGKERN uni1F07 uni1FBE =: uni1F87 ; +% LIGKERN uni1F70 uni1FBE =: uni1FB2 ; +% LIGKERN uni1FB6 uni1FBE =: uni1FB7 ; +% LIGKERN eta uni1FBE =: uni1FC3 ; +% LIGKERN etatonos uni1FBE =: uni1FC4 ; +% LIGKERN uni1F20 uni1FBE =: uni1F90 ; +% LIGKERN uni1F21 uni1FBE =: uni1F91 ; +% LIGKERN uni1F22 uni1FBE =: uni1F92 ; +% LIGKERN uni1F23 uni1FBE =: uni1F93 ; +% LIGKERN uni1F24 uni1FBE =: uni1F94 ; +% LIGKERN uni1F25 uni1FBE =: uni1F95 ; +% LIGKERN uni1F26 uni1FBE =: uni1F96 ; +% LIGKERN uni1F27 uni1FBE =: uni1F97 ; +% LIGKERN uni1F74 uni1FBE =: uni1FC2 ; +% LIGKERN uni1FC6 uni1FBE =: uni1FC7 ; +% LIGKERN omega uni1FBE =: uni1FF3 ; +% LIGKERN omegatonos uni1FBE =: uni1FF4 ; +% LIGKERN uni1F60 uni1FBE =: uni1FA0 ; +% LIGKERN uni1F61 uni1FBE =: uni1FA1 ; +% LIGKERN uni1F62 uni1FBE =: uni1FA2 ; +% LIGKERN uni1F63 uni1FBE =: uni1FA3 ; +% LIGKERN uni1F64 uni1FBE =: uni1FA4 ; +% LIGKERN uni1F65 uni1FBE =: uni1FA5 ; +% LIGKERN uni1F66 uni1FBE =: uni1FA6 ; +% LIGKERN uni1F67 uni1FBE =: uni1FA7 ; +% LIGKERN uni1F7C uni1FBE =: uni1FF2 ; +% LIGKERN uni1FF6 uni1FBE =: uni1FF7 ; + +% LIGKERN uni1FED iota =: uni1FD2 ; +% LIGKERN uni1FED upsilon =: uni1FE2 ; + +% LIGKERN uni1FC1 iota =: uni1FD7 ; +% LIGKERN uni1FC1 upsilon =: uni1FE7 ; diff --git a/fonts/gentium-tug/source/lig/gentium-t2a.lig b/fonts/gentium-tug/source/lig/gentium-t2a.lig new file mode 100644 index 0000000000..306d751aa3 --- /dev/null +++ b/fonts/gentium-tug/source/lig/gentium-t2a.lig @@ -0,0 +1,8 @@ +% LIGKERN hyphen hyphen =: endash ; +% LIGKERN endash hyphen =: emdash ; +% LIGKERN quoteleft quoteleft =: quotedblleft ; +% LIGKERN quoteright quoteright =: quotedblright ; +% LIGKERN comma comma =: quotedblbase ; +% LIGKERN less less =: guillemotleft ; +% LIGKERN greater greater =: guillemotright ; +% LIGKERN f f =: ff ; f i =: fi ; f l =: fl ; ff i =: ffi ; ff l =: ffl ; diff --git a/fonts/gentium-tug/source/lig/gentium-t2b.lig b/fonts/gentium-tug/source/lig/gentium-t2b.lig new file mode 100644 index 0000000000..306d751aa3 --- /dev/null +++ b/fonts/gentium-tug/source/lig/gentium-t2b.lig @@ -0,0 +1,8 @@ +% LIGKERN hyphen hyphen =: endash ; +% LIGKERN endash hyphen =: emdash ; +% LIGKERN quoteleft quoteleft =: quotedblleft ; +% LIGKERN quoteright quoteright =: quotedblright ; +% LIGKERN comma comma =: quotedblbase ; +% LIGKERN less less =: guillemotleft ; +% LIGKERN greater greater =: guillemotright ; +% LIGKERN f f =: ff ; f i =: fi ; f l =: fl ; ff i =: ffi ; ff l =: ffl ; diff --git a/fonts/gentium-tug/source/lig/gentium-t2c.lig b/fonts/gentium-tug/source/lig/gentium-t2c.lig new file mode 100644 index 0000000000..306d751aa3 --- /dev/null +++ b/fonts/gentium-tug/source/lig/gentium-t2c.lig @@ -0,0 +1,8 @@ +% LIGKERN hyphen hyphen =: endash ; +% LIGKERN endash hyphen =: emdash ; +% LIGKERN quoteleft quoteleft =: quotedblleft ; +% LIGKERN quoteright quoteright =: quotedblright ; +% LIGKERN comma comma =: quotedblbase ; +% LIGKERN less less =: guillemotleft ; +% LIGKERN greater greater =: guillemotright ; +% LIGKERN f f =: ff ; f i =: fi ; f l =: fl ; ff i =: ffi ; ff l =: ffl ; diff --git a/fonts/gentium-tug/source/lig/gentium-x2.lig b/fonts/gentium-tug/source/lig/gentium-x2.lig new file mode 100644 index 0000000000..e632c655de --- /dev/null +++ b/fonts/gentium-tug/source/lig/gentium-x2.lig @@ -0,0 +1,7 @@ +% LIGKERN hyphen hyphen =: endash ; +% LIGKERN endash hyphen =: emdash ; +% LIGKERN quoteleft quoteleft =: quotedblleft ; +% LIGKERN quoteright quoteright =: quotedblright ; +% LIGKERN comma comma =: quotedblbase ; +% LIGKERN less less =: guillemotleft ; +% LIGKERN greater greater =: guillemotright ; diff --git a/fonts/gentium-tug/source/make-zip-4CTAN.sh b/fonts/gentium-tug/source/make-zip-4CTAN.sh new file mode 100755 index 0000000000..28ff5c5316 --- /dev/null +++ b/fonts/gentium-tug/source/make-zip-4CTAN.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. + +mydir=`cd \`dirname $0\` && pwd` + +if test "x$1" = x-l || whoami | grep karl >/dev/null; then + # i always forget + local=true +else + local=false +fi + +rm -rf /tmp/gentium?????? +#tmpdir=`mktemp -d /tmp/gentiumXXXXXX` +tmpdir=/tmp/gnt; rm -rf $tmpdir; mkdir $tmpdir +cd "$tmpdir" || exit 1 + +if $local; then + TDS=`cd $mydir/../../.. && pwd` +else + TDS="$tmpdir/TDS" + svn co "http://svn.contextgarden.net/gentium/gentium/" "$TDS" +fi + +pkgname=gentium-tug +(cd $TDS/doc/fonts/$pkgname && make clean) +(cd $TDS/source/fonts/$pkgname && make clean) + +CTAN="$tmpdir/$pkgname" +mkdir -p "$CTAN/map" || exit 1 + +rsync="rsync -a --delete --exclude=**/.svn" +$rsync "$TDS/doc/fonts/$pkgname/" "$CTAN/doc/" || exit 1 +$rsync "$TDS/source/fonts/$pkgname/" "$CTAN/source/" +$rsync "$TDS/tex/context/third/$pkgname/" "$CTAN/context/" +$rsync "$TDS/tex/latex/$pkgname/" "$CTAN/latex/" +$rsync "$TDS/fonts/afm/public/$pkgname/" "$CTAN/afm/" +$rsync "$TDS/fonts/tfm/public/$pkgname/" "$CTAN/tfm/" +$rsync "$TDS/fonts/truetype/public/$pkgname/" "$CTAN/truetype/" +$rsync "$TDS/fonts/type1/public/$pkgname/" "$CTAN/type1/" +$rsync "$TDS/fonts/enc/dvips/$pkgname/" "$CTAN/enc/" +$rsync "$TDS/fonts/map/dvips/$pkgname/" "$CTAN/map/dvips/" +$rsync "$TDS/fonts/map/pdftex/$pkgname/" "$CTAN/map/pdftex/" + +printf "\f making .tds.zip:\n" +tdszip_dest=$tmpdir +(cd $TDS \ + && zip -qr $tdszip_dest/$pkgname.tds.zip [a-z]* -x \*.svn\*) # not README + +printf "\f making combined zip for upload:\n" +ln -s doc/README $CTAN/README +(cd $tmpdir && zip -qry $tmpdir/$pkgname.zip *) # -y: keep README as symlink + +# create a single .zip for upload that contains +# a) $pkgname.tds.zip +# b) $pkgname/ subdir for browsing +# because that's what CTAN wants these days. + +if $local; then :; else + echo + echo "Please make sure that you have set" + echo " use-commit-times = yes" + echo "in ~/.subversion/config" + echo +fi + +ls -l $tdszip_dest/$pkgname.tds.zip $tmpdir/$pkgname.zip + diff --git a/fonts/gentium-tug/source/type1/GentiumPlus-I-Czech.kern b/fonts/gentium-tug/source/type1/GentiumPlus-I-Czech.kern new file mode 100644 index 0000000000..9a9e6af87b --- /dev/null +++ b/fonts/gentium-tug/source/type1/GentiumPlus-I-Czech.kern @@ -0,0 +1,17 @@ +KPX dcaron a -100 +KPX dcaron aacute -100 +KPX dcaron o -100 +KPX dcaron oacute -100 +KPX dcaron u -80 +KPX dcaron uring -80 +KPX dcaron t -80 +KPX dcaron m -80 +KPX dcaron k -60 +KPX lcaron a -100 +KPX lcaron aacute -100 +KPX lcaron o -100 +KPX lcaron oacute -100 +KPX lcaron u -80 +KPX lcaron t -80 +KPX lcaron m -80 +KPX lcaron k -60 diff --git a/fonts/gentium-tug/source/type1/GentiumPlus-R-Czech.kern b/fonts/gentium-tug/source/type1/GentiumPlus-R-Czech.kern new file mode 100644 index 0000000000..1129eff7b9 --- /dev/null +++ b/fonts/gentium-tug/source/type1/GentiumPlus-R-Czech.kern @@ -0,0 +1,17 @@ +KPX dcaron a -80 +KPX dcaron aacute -80 +KPX dcaron o -80 +KPX dcaron oacute -80 +KPX dcaron u -60 +KPX dcaron uring -60 +KPX dcaron t -60 +KPX dcaron m -60 +KPX dcaron k -40 +KPX lcaron a -80 +KPX lcaron aacute -80 +KPX lcaron o -80 +KPX lcaron oacute -80 +KPX lcaron u -60 +KPX lcaron t -60 +KPX lcaron m -60 +KPX lcaron k -40 diff --git a/fonts/gentium-tug/source/type1/Makefile b/fonts/gentium-tug/source/type1/Makefile new file mode 100644 index 0000000000..d432621ee9 --- /dev/null +++ b/fonts/gentium-tug/source/type1/Makefile @@ -0,0 +1,45 @@ +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. +# +# The build scripts for Type 1 fonts need some afm files already +# available. If new TTF files are released, it is best to keep the +# old Type 1 fonts, copy the new TTF files and run the scripts. +# +# Currently, the scripts first make additional kerning pairs from +# the existing afm files and then convert the fonts to Type 1 format +# using these additional kerning pairs. That means that you may need to +# run "make" twice to get stable result if you change some metrics in the +# script ff-gentium.pe. For example if you change the kern value for the +# pair DV, then the first run will change the value just for this pair and +# the second run will change the values also for all the derived pairs +# (accented letters, small caps). + +AFM_PATH='../../../../fonts/afm/public/gentium-tug' +PFB_PATH='../../../../fonts/type1/public/gentium-tug' + +all: kerns + ./ff-gentium.pe GentiumPlus-R.ttf GentiumPlus-I.ttf \ + GenBasB.ttf GenBasBI.ttf + # Change the creator to "TeX Users Group" + for I in *.pfb; do \ + t1disasm $$I | sed 's/%%Creator: .*/%%Creator: TeX Users Group/' \ + > gentium.disasm; \ + t1asm gentium.disasm $$I; \ + done + for I in *.afm; do ./afmcreator.py $$I; done + rm *-extra.afm + rm *.otf *.sfd + rm gentium.disasm + mv -f *.afm $(AFM_PATH) + mv -f *.pfb $(PFB_PATH) + +# Generate extra kerning pairs (and keep them). +kerns: + ./generate-extra-kerns.sh + +# Run the generated Type 1 fonts through t1lint. When there is +# no error message, then the fonts are probably Ok. +test: + for I in $(PFB_PATH)/*.pfb; do \ + t1lint $$I; \ + done diff --git a/fonts/gentium-tug/source/type1/afmcreator.py b/fonts/gentium-tug/source/type1/afmcreator.py new file mode 100755 index 0000000000..bc44f1cd85 --- /dev/null +++ b/fonts/gentium-tug/source/type1/afmcreator.py @@ -0,0 +1,22 @@ +#! /usr/bin/env python +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. + +import os, sys + +creatortext = "Comment Creator: TeX Users Group\n" + +tempname = "temp.afm" + +fin = open(sys.argv[1], "r") +fout = open(tempname, "w") +while True: + s = fin.readline() + if s == "": break # end of file + fout.write(s) + if s.find("Comment Creation Date") == 0 : + fout.write(creatortext) # Creator after Creation Date +fin.close() +fout.close() + +os.rename(tempname, sys.argv[1]) diff --git a/fonts/gentium-tug/source/type1/ff-gentium.pe b/fonts/gentium-tug/source/type1/ff-gentium.pe new file mode 100755 index 0000000000..108d231835 --- /dev/null +++ b/fonts/gentium-tug/source/type1/ff-gentium.pe @@ -0,0 +1,177 @@ +#!/usr/bin/env fontforge +# $Id: ff-gentium.pe 15 2015-04-23 22:29:19Z karl $ +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. + +# It is heavily based on the work by Clea F. Rees (ff-gentium-vgx.pe), +# with some modifications and additions by Pavel Farar. +# +# The script is dirty now. It relies on the order in which the fonts are +# processed and maybe on some other things. I will see if it will be +# easier for me to do clean up or rewrite it to Python. I would prefer +# the latter, because the syntax is more familiar to me. + +# You can set the desired copyright text in the following variable +FONT_COPYRIGHT='Copyright (c) SIL International, 2003-2014. TeX conversion additions copyright (c) 2013-2015 TeX Users Group. Released under the OFL, http://scripts.sil.org/OFL.' + +TTF_PATH='../../../../fonts/truetype/public/gentium-tug/' +FONT_VERSION_PLUS='gentiumps-1.1 (from Gentium Plus 5.000; 2014; Major update)' +FONT_VERSION_BASIC='gentiumps-1.0 (from Gentium Basic 1.100; 2008; Maintenance release)' + +LoadNamelist("vgx.nam") + +i = 1 + +while ( i < $argc ) + + Print("* ----------------------------------------") + Print("* Converting font " + $argv[i] + " to Type 1") + Print("* Reading TrueType") + Open(TTF_PATH + $argv[i]) + + # Removing problematic lookups "mark" and "mkmk" from GentiumPlus. + # This eliminates really huge amount of error messages. + if ( $argv[i] == "GentiumPlus-R.ttf" || $argv[i] == "GentiumPlus-I.ttf" ) + Print("* Removing problematic lookups mark and mkmk") + # TODO: Don't use these hard-coded names, use GetLookups("GPOS") + RemoveLookup("'mark' Mark Positioning lookup 0") + RemoveLookup("'mark' Mark Positioning lookup 1") + RemoveLookup("'mkmk' Mark to Mark lookup 2") + RemoveLookup("'mkmk' Mark to Mark lookup 3") + endif + + # attempt to follow Hirwen's instructions: + Print("* Scaling") + ScaleToEm(1000) + Print("* Generating OpenType") + Generate($argv[i]:r + ".otf","",-1) # is the OpenType really needed? + Close() + + Print("* Reading OpenType") + Open($argv[i]:r + ".otf") + + # TODO: Move following commands before generating OpenType + SetFontOrder(3) # just to be sure + SelectAll() + Print("* Simplifying") + Simplify() + Simplify(104,5) + Print("* Adding extrema") + AddExtrema() + + # Moving autohinting after guessing blue values makes no difference. + Print("* Autohinting") + AutoHint() + # ps private + Print("* Guessing blue values") + PrivateGuess("BlueValues") + PrivateGuess("OtherBlues") + PrivateGuess("BlueScale") + PrivateGuess("BlueShift") + # Hirwen doesn't include this though LM has it (and also FalseBold set as false - even for bold!) + PrivateGuess("BlueFuzz") + PrivateGuess("StdHW") + PrivateGuess("StdVW") + PrivateGuess("StemSnapH") + PrivateGuess("StemSnapV") + PrivateGuess("ExpansionFactor") + + # Family blue values + # Adobe says that FamilyBlues and FamilyOtherBlues should be set for + # non-regular styles and that the values should be taken from + # BlueValues and OtherBlues for regular style. Unfortunately, it is + # impossible to use the values from the regular style for bold and + # bold italic styles--t1lint complained (too big difference). Therefore, + # family blues for the italic style are taken from the regular style and + # values for the bold italic style are taken from the bold style. + # It makes sense from another point of view: two fonts from GentiumPlus + # make one family, two fonts from GentiumBasic make other family. + # TODO: clean-up of the following code + if ( $argv[i] == "GentiumPlus-R.ttf" ) + BlueValuesRegular = GetPrivateEntry("BlueValues") + OtherBluesRegular = GetPrivateEntry("OtherBlues") + endif + if ( $argv[i] == "GentiumPlus-I.ttf" ) + ChangePrivateEntry("FamilyBlues", BlueValuesRegular) + ChangePrivateEntry("FamilyOtherBlues", OtherBluesRegular) + endif + if ( $argv[i] == "GenBasB.ttf" ) + BlueValuesBold = GetPrivateEntry("BlueValues") + OtherBluesBold = GetPrivateEntry("OtherBlues") + endif + if ( $argv[i] == "GenBasBI.ttf" ) + ChangePrivateEntry("FamilyBlues", BlueValuesBold) + ChangePrivateEntry("FamilyOtherBlues", OtherBluesBold) + endif + + # Hirwen says add forcebold and write true if font is bold (or bold italic). + # Adobe strongly advises to set ForceBold explicitly (true or false). + if ( $argv[i] == "GentiumPlus-R.ttf" || $argv[i] == "GentiumPlus-I.ttf" ) + ChangePrivateEntry("ForceBold", "false") + else + ChangePrivateEntry("ForceBold", "true") + endif + + # Hirwen says to repeat with the os/2 and panose panels but these already seem to be filled out... + # os/2 + #SetOS2Value(field-name,field-value) + # Usually the second argument is an integer but VendorID takes a 4 character ASCII string, and Panose takes a 10 element integer array. + #Weight, Width, FSType, IBMFamily, VendorID, Panose, WinAscent, WinAscentIsOffset, WinDescent, WinDescentIsOffset, TypoAscent, TypoAscentIsOffset, TypoDescent, TypoDescentIsOffset, HHeadAscent, HHeadAscentIsOffset, HHeadDescent, HHeadDescentIsOffset, TypoLineGap, HHeadLineGap, VHeadLineGap, SubXSize, SubYSize, SubXOffset, SubYOffset, SupXSize, SupYSize, SupXOffset, SupYOffset, StrikeOutSize, StrikeOutPos + + Save($argv[i]:r + ".sfd") # Is it really needed? + + # Reencoding to Adobe Standard Encoding introduced many slots with ".notdef". + # These slots can be either cleared (if you uncomment the following + # commands) or the reencoding can be switched off (if the following commands + # are commented out) +# Print("* Reencoding") +# Reencode("AdobeStandardEncoding") +# Select(".notdef") +# Clear() + +# RenameGlyphs("vgx") # currently switched off, file vgx not present; + + Print("* Setting font names") +# SetFontNames(fontname[,family[,fullname[,weight[,copyright-notice[,fontversion]]]]]) + # Note that this is not at all robust. If it doesn't work, comment out all the lines in the next block except for the single line between the "else" and the "endif". This will produce names which may be less than ideal from an aesthetic point of view but should at least work. + hyphened=Strrstr($fontname,"-") + spaced=Strrstr($fullname," ") + if ( $argv[i] == "GentiumPlus-R.ttf" || $argv[i] == "GentiumPlus-I.ttf" ) + FONT_VERSION=FONT_VERSION_PLUS + else + FONT_VERSION=FONT_VERSION_BASIC + endif + if ( hyphened > 0 ) + fontnamecyntaf=Strsub($fontname,0,hyphened) + fontnameail=Strsub($fontname,hyphened) + fullnamecyntaf=Strsub($fullname,0,spaced) + fullnameail=Strsub($fullname,spaced) + SetFontNames(fontnamecyntaf + "PS" + fontnameail,$familyname + " PS", fullnamecyntaf + " PS" + fullnameail, $weight, FONT_COPYRIGHT, FONT_VERSION) + else + SetFontNames($fontname + "PS",$familyname + " PS", $fullname + " PS", $weight, FONT_COPYRIGHT, FONT_VERSION) + endif + + + # Corrections for Greek (automatically generated values) and additional kerns + # TODO: Don't use hard-coded names, check the existence of extra kernings instead + if ( $argv[i] == "GentiumPlus-R.ttf" ) + Print("* Correction for Greek and additional kerning pairs") + MergeFeature("GentiumPlus-R-extra.afm") + endif + if ( $argv[i] == "GentiumPlus-I.ttf" ) + Print("* Correction for Greek and additional kerning pairs") + MergeFeature("GentiumPlus-I-extra.afm") + endif + + # Correction of the kern between D and V in "GentiumPlus-R.ttf" + if ( $argv[i] == "GentiumPlus-R.ttf" ) + Print("* Correction of kern between D and V") + Select("D") + SetKern("V", -20) + endif + + Print("* Generating Type 1") + Generate($argv[i]:r + ".pfb","",-1) + i = i+1 + +endloop diff --git a/fonts/gentium-tug/source/type1/generate-extra-kerns.sh b/fonts/gentium-tug/source/type1/generate-extra-kerns.sh new file mode 100755 index 0000000000..8c2dc4dff6 --- /dev/null +++ b/fonts/gentium-tug/source/type1/generate-extra-kerns.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. + +# Generates extra kerning pairs for Greek. +# GentiumBasic has no Greek, so no correction is needed. +# +# If you want to keep the files with extra kerning pairs, +# run just this script. + +TTF_PATH="../../../../fonts/truetype/public/gentium-tug" +AFM_PATH="../../../../fonts/afm/public/gentium-tug" + +for i in GentiumPlus-R.ttf GentiumPlus-I.ttf; do + echo "----------------------------------------------" + echo "* Generating extra kerns for $i" + echo "* Converting font to sfd" + FILE_TTF="$TTF_PATH/$i" + FILE_SFD="$(basename $i .ttf).sfd" + fontforge -lang=ff -c "Open('$FILE_TTF');Save('$FILE_SFD')" + echo "* Calculating the kerns" + ./greekcorrection.py $(basename $i .ttf).sfd + ./kerncorrection.py "$AFM_PATH/$(basename $i .ttf).afm" $(basename $i .ttf)-extra.afm + cat $(basename $i .ttf)-Czech.kern >> $(basename $i .ttf)-extra.afm +done + +rm *sfd diff --git a/fonts/gentium-tug/source/type1/greekcorrection.py b/fonts/gentium-tug/source/type1/greekcorrection.py new file mode 100755 index 0000000000..16b328f590 --- /dev/null +++ b/fonts/gentium-tug/source/type1/greekcorrection.py @@ -0,0 +1,233 @@ +#! /usr/bin/env python +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. +# author: Pavel Farar, pavel.farar@centrum.cz +# +# This script generates extra kerning pairs for the +# combination accent + capital Greek letter. The kerning +# pairs will have such a value that the combination will +# look like the precomposed accented letter (with the +# exception of the left side bearing). The input must be +# a fontforge source (sfd file) and the output will have +# the same form as kerning pairs in the afm file +# +# The main idea is that the fontforge source contains the +# information how the accented letter is composed from the +# accent and the base letter. The relevant information is +# the width of the accent and the position of the accent +# and the base letter (how they are moved from the position +# X = 0). The kerning is computed using the following formula: +# +# Kern = X_letter - X_accent - WidthOfAccent +# +# This script is dirtier than it could be. The +# reason is that it should work with different fonts, +# but some fonts have problems. There is a problem +# with the letter Omega in GentiumPlus which has not +# the usual unicode value. In DejaVu the precomposed +# letters are composed sometimes as accent + letter, +# but sometimes also as letter + accent. + +import sys + +# Table with LIGKERNs for Greek capital letters, where +# first (accent) + second (letter) gives third (accented +# letter. Well, probably not the best term, but I created +# the following table to a great extent automatically +# from the LIGKERN commands for the precomposed small Greek +# accented letters in the encoding LGR. Then I did uppercasing +# using information from Unicode and looked if there is +# some accented letter missing. Therefore I call it +# LigatureTable and this file uses one line for every +# capital Greek letter. I did it in such a way to avoid +# random errors. +LigatureTable = [] + +LigatureTable.append(['uni1FBF', 'Alpha', 'uni1F08']) +LigatureTable.append(['uni1FBF', 'Epsilon', 'uni1F18']) +LigatureTable.append(['uni1FBF', 'Eta', 'uni1F28']) +LigatureTable.append(['uni1FBF', 'Iota', 'uni1F38']) +LigatureTable.append(['uni1FBF', 'Omicron', 'uni1F48']) +LigatureTable.append(['uni1FBF', 'Omega', 'uni1F68']) +LigatureTable.append(['uni1FFE', 'Alpha', 'uni1F09']) +LigatureTable.append(['uni1FFE', 'Epsilon', 'uni1F19']) +LigatureTable.append(['uni1FFE', 'Eta', 'uni1F29']) +LigatureTable.append(['uni1FFE', 'Iota', 'uni1F39']) +LigatureTable.append(['uni1FFE', 'Omicron', 'uni1F49']) +LigatureTable.append(['uni1FFE', 'Upsilon', 'uni1F59']) +LigatureTable.append(['uni1FFE', 'Omega', 'uni1F69']) +LigatureTable.append(['uni1FFE', 'Rho', 'uni1FEC']) +LigatureTable.append(['uni1FCD', 'Alpha', 'uni1F0A']) +LigatureTable.append(['uni1FCD', 'Epsilon', 'uni1F1A']) +LigatureTable.append(['uni1FCD', 'Eta', 'uni1F2A']) +LigatureTable.append(['uni1FCD', 'Iota', 'uni1F3A']) +LigatureTable.append(['uni1FCD', 'Omicron', 'uni1F4A']) +LigatureTable.append(['uni1FCD', 'Omega', 'uni1F6A']) +LigatureTable.append(['uni1FDD', 'Alpha', 'uni1F0B']) +LigatureTable.append(['uni1FDD', 'Epsilon', 'uni1F1B']) +LigatureTable.append(['uni1FDD', 'Eta', 'uni1F2B']) +LigatureTable.append(['uni1FDD', 'Iota', 'uni1F3B']) +LigatureTable.append(['uni1FDD', 'Omicron', 'uni1F4B']) +LigatureTable.append(['uni1FDD', 'Upsilon', 'uni1F5B']) +LigatureTable.append(['uni1FDD', 'Omega', 'uni1F6B']) +LigatureTable.append(['uni1FCE', 'Alpha', 'uni1F0C']) +LigatureTable.append(['uni1FCE', 'Epsilon', 'uni1F1C']) +LigatureTable.append(['uni1FCE', 'Eta', 'uni1F2C']) +LigatureTable.append(['uni1FCE', 'Iota', 'uni1F3C']) +LigatureTable.append(['uni1FCE', 'Omicron', 'uni1F4C']) +LigatureTable.append(['uni1FCE', 'Omega', 'uni1F6C']) +LigatureTable.append(['uni1FDE', 'Alpha', 'uni1F0D']) +LigatureTable.append(['uni1FDE', 'Epsilon', 'uni1F1D']) +LigatureTable.append(['uni1FDE', 'Eta', 'uni1F2D']) +LigatureTable.append(['uni1FDE', 'Iota', 'uni1F3D']) +LigatureTable.append(['uni1FDE', 'Omicron', 'uni1F4D']) +LigatureTable.append(['uni1FDE', 'Upsilon', 'uni1F5D']) +LigatureTable.append(['uni1FDE', 'Omega', 'uni1F6D']) +LigatureTable.append(['uni1FCF', 'Alpha', 'uni1F0E']) +LigatureTable.append(['uni1FCF', 'Eta', 'uni1F2E']) +LigatureTable.append(['uni1FCF', 'Iota', 'uni1F3E']) +LigatureTable.append(['uni1FCF', 'Omega', 'uni1F6E']) +LigatureTable.append(['uni1FDF', 'Alpha', 'uni1F0F']) +LigatureTable.append(['uni1FDF', 'Eta', 'uni1F2F']) +LigatureTable.append(['uni1FDF', 'Iota', 'uni1F3F']) +LigatureTable.append(['uni1FDF', 'Upsilon', 'uni1F5F']) +LigatureTable.append(['uni1FDF', 'Omega', 'uni1F6F']) +LigatureTable.append(['uni1FEF', 'Alpha', 'uni1FBA']) +LigatureTable.append(['uni1FEF', 'Epsilon', 'uni1FC8']) +LigatureTable.append(['uni1FEF', 'Eta', 'uni1FCA']) +LigatureTable.append(['uni1FEF', 'Iota', 'uni1FDA']) +LigatureTable.append(['uni1FEF', 'Omicron', 'uni1FF8']) +LigatureTable.append(['uni1FEF', 'Upsilon', 'uni1FEA']) +LigatureTable.append(['uni1FEF', 'Omega', 'uni1FFA']) +LigatureTable.append(['tonos', 'Alpha', 'Alphatonos']) +LigatureTable.append(['tonos', 'Epsilon', 'Epsilontonos']) +LigatureTable.append(['tonos', 'Eta', 'Etatonos']) +LigatureTable.append(['tonos', 'Iota', 'Iotatonos']) +LigatureTable.append(['tonos', 'Omicron', 'Omicrontonos']) +LigatureTable.append(['tonos', 'Upsilon', 'Upsilontonos']) +LigatureTable.append(['tonos', 'Omega', 'Omegatonos']) + + +# Set with Greek accents +GreekAccents = set() # empty set +for i in range(len(LigatureTable)): + GreekAccents.add(LigatureTable[i][0]) + +# Set with Greek letters +GreekLetters = set() # empty set +for i in range(len(LigatureTable)): + GreekLetters.add(LigatureTable[i][1]) + +# Set with precomposed Greek letters +PrecomposedGreekLetters = set() # empty set +for i in range(len(LigatureTable)): + PrecomposedGreekLetters.add(LigatureTable[i][2]) + + +def UnicodeValue(s): + # The unicode value is the second number after "Encoding:" + if s.find('Encoding:') != 0: sys.exit('UnicodeValue error') + return s.split()[2] # The third item + + +def WidthValue(s): + if s.find('Width:') != 0: sys.exit('WidthValue error') + return s.split()[1] # The second item + + +# Dictionaries (all values are strings, not numbers!) +AccentWidth = {} +AccentUnicode = {} +LetterUnicode = {} + + +# Process the components (accents and base letters) +f = open(sys.argv[1], 'r') +farray = f.readlines() +f.close() +findex = -1 +while True: + findex = findex + 1 + if findex >= len(farray): break # end of file + s = farray[findex] + if s.find('StartChar: ') == 0 : + CharacterName = s[11:-1] + if CharacterName in GreekLetters: + findex = findex + 1 + s = farray[findex] + LetterUnicode[CharacterName] = UnicodeValue(s) + if CharacterName in GreekAccents: + findex = findex + 1 + s = farray[findex] + AccentUnicode[CharacterName] = UnicodeValue(s) + findex = findex + 1 + s = farray[findex] + AccentWidth[CharacterName] = WidthValue(s) + + +def MoveValue(ss, lindex): + sarray = ss.split() + if sarray[0] != 'Refer:': sys.exit('No Refer:') + x = int(sarray[8]) # the value of move + + # dirty hack to make Omega work in both Gentium and GentiumPlus + # This script without the following hack would work well for Gentium, but not for + # GentiumPlus. The problem with GentiumPlus is that the accented letters with Omega + # uses as a base letter that with the unicode value 937 (which should be Omega), but + # this letter has PostScript name uni03A9, not Omega. Omega has a different value. + if sarray[2] == '937': # the standard unicode value for Omega = problems in GentiumPlus + sarray[2] = LetterUnicode['Omega'] + + # is it accent or letter? + # unicode is the second number (third value) + if sarray[2] == AccentUnicode[LigatureTable[lindex][0]]: # accent + x = -x # the move of accent is taken negatively + elif sarray[2] == LetterUnicode[LigatureTable[lindex][1]]: # letter + x = +x # the move of letter is taken positively + else: + sys.exit('Bad unicode of component') + + return x + + +def KernValue(letter, s1, s2): + # letter - the name of the precomposed letter + # s1 - Refer to the accent (expected to be first) + # s2 - Refer to the letter + for i in range(len(LigatureTable)): + if LigatureTable[i][2] == letter: LetterIndex = i + + FirstMove = MoveValue(s1, LetterIndex) + SecondMove = MoveValue(s2, LetterIndex) + + return FirstMove + SecondMove - int(AccentWidth[LigatureTable[LetterIndex][0]]) + + + + +KernTable = {} + +# Process the precomposed letters +# The sfd file is still in "farray" +findex = -1 +while True: + findex = findex + 1 + if findex >= len(farray): break # end of file + s = farray[findex] + if s.find('StartChar: ') == 0 : + CharacterName = s[11:-1] + if CharacterName in PrecomposedGreekLetters: + while s.find('Refer: ') != 0 : + findex = findex + 1 + s = farray[findex] + KernTable[CharacterName] = KernValue(CharacterName, s, farray[findex + 1]) + + +# Write the kerning table +fafm = open(sys.argv[1][:-4] + '-extra.afm', 'w') +for i in range(len(LigatureTable)): + sourceKern = KernTable[LigatureTable[i][2]] + if sourceKern != 0: # remove zero kerns + fafm.write('KPX ' + LigatureTable[i][0] + ' ' + LigatureTable[i][1] + ' ' + + str(int(round(1000.0 / 2048.0 * sourceKern))) + '\n') +fafm.close() diff --git a/fonts/gentium-tug/source/type1/kerncorrection.py b/fonts/gentium-tug/source/type1/kerncorrection.py new file mode 100755 index 0000000000..323a065fa2 --- /dev/null +++ b/fonts/gentium-tug/source/type1/kerncorrection.py @@ -0,0 +1,274 @@ +#! /usr/bin/env python +# This file is part of the Gentium package for TeX. +# It is licensed under the Expat License, see doc//README for details. + +# Used uni0162 for Tcedilla and uni021A for Tcommaaccent + +import os, sys, re + +class KernReader: + def __init__(self, filename): + self.filename = filename + def getkerns(self, regex): + a = [] + f = open(self.filename, "r") + while True: + s = f.readline() + if s == "": break # end of file + if re.match(regex, s): + a.append(s) + f.close() + return a + + +class KernWriter: + # TODO: improve methods for quotes; probably merge them; also accented small caps; look + # also at other types of quotes, such as Polish and French; start with improving + # aacute.SC + quotedblleft and adieresis.SC + quotedblleft + # TODO: several methods could be merged (simpler code, but worse result to report to Victor) + kernpairscapital = [ + ["V A", "V Aacute", "V Abreve", "V Acircumflex", "V Adieresis", "V AE", "V Agrave", "V Amacron", "V Aogonek", "V Aring", "V Atilde"], + ["A Y", "A Yacute", "A Ydieresis", "Aacute Y", "Abreve Y", "Acircumflex Y", "Adieresis Y", "Agrave Y", "Amacron Y", "Aogonek Y", "Aring Y", "Atilde Y", "Aacute Yacute"], + ["L V", "Lcommaaccent V", "Lslash V"], + ["A V", "Aacute V", "Abreve V", "Acircumflex V", "Adieresis V", "Agrave V", "Amacron V", "Aogonek V", "Aring V", "Atilde V"], + ["W A", "W Aacute", "W Abreve", "W Acircumflex", "W Adieresis", "W AE", "W Agrave", "W Amacron", "W Aogonek", "W Aring", "W Atilde"], + ["Y A", "Y Aacute", "Y Abreve", "Y Acircumflex", "Y Adieresis", "Y AE", "Y Agrave", "Y Amacron", "Y Aogonek", "Y Aring", "Y Atilde", "Yacute A", "Ydieresis A", "Yacute Aacute"], + ["F A", "F Aacute", "F Abreve", "F Acircumflex", "F Adieresis", "F AE", "F Agrave", "F Amacron", "F Aogonek", "F Aring", "F Atilde"], + ["L Y", "L Yacute", "L Ydieresis", "Lcommaaccent Y", "Lslash Y"], + ["L T", "L Tcaron", "L uni0162", "L uni021A", "Lcommaaccent T", "Lslash T"], + ["A W", "Aacute W", "Abreve W", "Acircumflex W", "Adieresis W", "Agrave W", "Amacron W", "Aogonek W", "Aring W", "Atilde W"], + ["P A", "P Aacute", "P Abreve", "P Acircumflex", "P Adieresis", "P AE", "P Agrave", "P Amacron", "P Aogonek", "P Aring", "P Atilde"], + ["T A", "T Aacute", "T Abreve", "T Acircumflex", "T Adieresis", "T AE", "T Agrave", "T Amacron", "T Aogonek", "T Aring", "T Atilde", "Tcaron A", "uni0162 A", "uni021A A", "Tcaron Aacute"], + ["A T", "A Tcaron", "A uni0162", "A uni021A", "Aacute T", "Abreve T", "Acircumflex T", "Adieresis T", "Agrave T", "Amacron T", "Aogonek T", "Aring T", "Atilde T", "Aacute Tcaron"], + ["U A", "U Aacute", "U Abreve", "U Acircumflex", "U Adieresis", "U AE", "U Agrave", "U Amacron", "U Aogonek", "Uacute A", "Ucircumflex A", "Udieresis A", "Ugrave A", "Uhungarumlaut A", "Umacron A", "Uogonek A", "Uring A", "Uacute Aacute", "Uring Aacute"], + ["A U", "A Uacute", "A Ucircumflex", "A Udieresis", "A Ugrave", "A Uhungarumlaut", "A Umacron", "A Uogonek", "A Uring", "Aacute U", "Abreve U", "Acircumflex U", "Adieresis U", "Agrave U", "Amacron U", "Aogonek U", "Aacute Uacute", "Aacute Uring"], + ["R V", "Racute V", "Rcaron V", "Rcommaaccent V"], + ["V G", "V Gbreve", "V Gcircumflex", "V Gcommaaccent"], + ["V O", "V Oacute", "V Ocircumflex", "V Odieresis", "V OE", "V Ograve", "V Ohungarumlaut", "V Omacron", "V Oslash", "V Otilde"], + ["Y O", "Y Oacute", "Y Ocircumflex", "Y Odieresis", "Y OE", "Y Ograve", "Y Ohungarumlaut", "Y Omacron", "Y Oslash", "Y Otilde", "Yacute O", "Ydieresis O", "Yacute Oacute"], + ["C A", "C Aacute", "C Abreve", "C Acircumflex", "C Adieresis", "C AE", "C Agrave", "C Amacron", "C Aogonek", "C Aring", "C Atilde", "Cacute A", "Ccaron A", "Ccedilla A", "Ccircumflex A", "Ccaron Aacute"], + # Dcaron can not be followed by Y with or without accent in a standard word, but I can + # imagine some abbreviation or compound word with this combination + ["D A", "D Aacute", "D Abreve", "D Acircumflex", "D Adieresis", "D AE", "D Agrave", "D Amacron", "D Aogonek", "D Aring", "D Atilde", "Dcaron A", "Dcroat A", "Dcaron Aacute"], + ["D Y", "D Yacute", "D Ydieresis", "Dcaron Y", "Dcroat Y", "Dcaron Yacute"], + ["K O", "K Oacute", "K Ocircumflex", "K Odieresis", "K OE", "K Ograve", "K Ohungarumlaut", "K Omacron", "K Oslash", "K Otilde", "Kcommaaccent O"], + ["L W", "Lcommaaccent W", "Lslash W"], + # there would be many kerns for O A when using kern classes; the same for A O + ["O A", "O Aacute", "O Abreve", "O Acircumflex", "O Adieresis", "O AE", "O Agrave", "O Amacron", "O Aogonek", "O Aring", "O Atilde", "Oacute A", "Ocircumflex A", "Odieresis A", "Ograve A", "Ohungarumlaut A", "Omacron A", "Oslash A", "Otilde A", "Oacute Aacute"], + ["O V", "Oacute V", "Ocircumflex V", "Odieresis V", "Ohungarumlaut V", "Omacron V", "Oslash V", "Otilde V"], + ["O Y", "O Yacute", "O Ydieresis", "Oacute Y", "Ocircumflex Y", "Odieresis Y", "Ograve Y", "Ohungarumlaut Y", "Omacron Y", "Oslash Y", "Otilde Y", "Oacute Yacute"], + ["R W", "Racute W", "Rcaron W", "Rcommaaccent W"], + ["O X", "Oacute X", "Ocircumflex X", "Odieresis X", "Ograve X", "Ohungarumlaut X", "Omacron X", "Oslash X", "Otilde X"], + ["R T", "R Tcaron", "R uni0162", "R uni021A", "Racute T", "Rcaron T", "Rcommaaccent T", "Rcaron Tcaron"], + ["W O", "W Oacute", "W Ocircumflex", "W Odieresis", "W OE", "W Ograve", "W Ohungarumlaut", "W Omacron", "W Oslash", "W Otilde"], + ["Y S", "Y Scaron", "Yacute S", "Ydieresis S", "Yacute Scaron"], + ["A C", "A Cacute", "A Ccaron", "A Ccedilla", "A Ccircumflex", "Aacute C", "Abreve C", "Acircumflex C", "Adieresis C", "Agrave C", "Amacron C", "Aogonek C", "Aring C", "Atilde C", "Aacute Ccaron"], + ["A G", "A Gbreve", "A Gcircumflex", "A Gcommaaccent", "Aacute G", "Abreve G", "Acircumflex G", "Adieresis G", "Agrave G", "Amacron G", "Aogonek G", "Aring G", "Atilde G"], + ["A O", "A Oacute", "A Ocircumflex", "A Odieresis", "A OE", "A Ograve", "A Ohungarumlaut", "A Omacron", "A Oslash", "A Otilde", "Aacute O", "Abreve O", "Acircumflex O", "Adieresis O", "Agrave O", "Amacron O", "Aogonek O", "Aring O", "Atilde O", "Aacute Oacute"], + ["A Q", "Aacute Q", "Abreve Q", "Acircumflex Q", "Adieresis Q", "Agrave Q", "Amacron Q", "Aogonek Q", "Aring Q", "Atilde Q"], + ["D W", "Dcaron W", "Dcroat W"], + # problematic kern follows (the kern value of DV was positive in GentiumPlus Regular) + ["D V", "Dcaron V", "Dcroat V"] + ] + kernpairsinitialcap = [ + ["V a", "V aacute", "V abreve", "V acircumflex", "V adieresis", "V ae", "V agrave", "V amacron", "V aogonek", "V aring", "V atilde"], + ["V e", "V eacute", "V ecaron", "V ecircumflex", "V edieresis", "V edotaccent", "V egrave", "V emacron", "V eogonek"], + ["V o", "V oacute", "V ocircumflex", "V odieresis", "V oe", "V ograve", "V ohungarumlaut", "V omacron", "V oslash", "V otilde"], + ["Y a", "Y aacute", "Y abreve", "Y acircumflex", "Y adieresis", "Y ae", "Y agrave", "Y amacron", "Y aogonek", "Y aring", "Y atilde", "Yacute a", "Ydieresis a", "Yacute aacute"], + ["Y e", "Y eacute", "Y ecaron", "Y ecircumflex", "Y edieresis", "Y edotaccent", "Y egrave", "Y emacron", "Y eogonek", "Yacute e", "Ydieresis e", "Yacute eacute", "Yacute ecaron"], + ["Y o", "Y oacute", "Y ocircumflex", "Y odieresis", "Y oe", "Y ograve", "Y ohungarumlaut", "Y omacron", "Y oslash", "Y otilde", "Yacute o", "Ydieresis o", "Yacute oacute"], + # not used the combination "Y u" that is only in GentiumPlus regular + ["A v", "Aacute v", "Abreve v", "Acircumflex v", "Adieresis v", "Agrave v", "Amacron v", "Aogonek v", "Aring v", "Atilde v"], + ["A w", "Aacute w", "Abreve w", "Acircumflex w", "Adieresis w", "Agrave w", "Amacron w", "Aogonek w", "Aring w", "Atilde w"], + ["A y", "A yacute", "A ydieresis", "Aacute y", "Abreve y", "Acircumflex y", "Adieresis y", "Agrave y", "Amacron y", "Aogonek y", "Aring y", "Atilde y", "Aacute yacute"], + ["F a", "F aacute", "F abreve", "F acircumflex", "F adieresis", "F ae", "F agrave", "F amacron", "F aogonek", "F aring", "F atilde"], + ["F e", "F eacute", "F ecaron", "F ecircumflex", "F edieresis", "F edotaccent", "F egrave", "F emacron", "F eogonek"], + ["F o", "F oacute", "F ocircumflex", "F odieresis", "F oe", "F ograve", "F ohungarumlaut", "F omacron", "F oslash", "F otilde"], + ["T a", "T aacute", "T abreve", "T acircumflex", "T adieresis", "T ae", "T agrave", "T amacron", "T aogonek", "T aring", "T atilde", "Tcaron a", "uni0162 a", "uni021A a", "Tcaron aacute"], + ["T e", "T eacute", "T ecaron", "T ecircumflex", "T edieresis", "T edotaccent", "T egrave", "T emacron", "T eogonek", "Tcaron e", "uni0162 e", "uni021A e"], + ["T o", "T oacute", "T ocircumflex", "T odieresis", "T oe", "T ograve", "T ohungarumlaut", "T omacron", "T oslash", "T otilde", "Tcaron o", "uni0162 o", "uni021A o", "Tcaron oacute"], + ["W a", "W aacute", "W abreve", "W acircumflex", "W adieresis", "W ae", "W agrave", "W amacron", "W aogonek", "W aring", "W atilde"], + ["W e", "W eacute", "W ecaron", "W ecircumflex", "W edieresis", "W edotaccent", "W egrave", "W emacron", "W eogonek"], + ["W o", "W oacute", "W ocircumflex", "W odieresis", "W oe", "W ograve", "W ohungarumlaut", "W omacron", "W oslash", "W otilde"] + ] + kernpairssmall = [ + ["v e", "v eacute", "v ecaron", "v ecircumflex", "v edieresis", "v edotaccent", "v egrave", "v emacron", "v eogonek"], + ["k e", "k eacute", "k ecaron", "k ecircumflex", "k edieresis", "k edotaccent", "k egrave", "k emacron", "k eogonek", "kcommaaccent e"], + ["o v", "oacute v", "ocircumflex v", "odieresis v", "ograve v", "oslash v", "otilde v"], + ["o x", "oacute x", "ocircumflex x", "odieresis x", "ograve x", "oslash x", "otilde x"], + ["v a", "v aacute", "v abreve", "v acircumflex", "v adieresis", "v ae", "v agrave", "v amacron", "v aogonek", "v aring", "v atilde"], + ["v o", "v oacute", "v ocircumflex", "v odieresis", "v oe", "v ograve", "v ohungarumlaut", "v omacron", "v oslash", "v otilde"], + ["r a", "r aacute", "r abreve", "r acircumflex", "r adieresis", "r ae", "r agrave", "r amacron", "r aogonek", "r aring", "r atilde", "racute a", "rcaron a", "rcommaaccent a", "rcaron aacute"], + ["r e", "r eacute", "r ecaron", "r edieresis", "r edotaccent", "r egrave", "r emacron", "r eogonek", "racute e", "rcaron e", "rcommaaccent e", "rcaron eacute"], + ["r c", "r cacute", "r ccaron", "r ccedilla", "r cdotaccent", "racute c", "rcaron c", "rcommaaccent c", "rcaron ccaron"], + ["r q", "racute q", "rcaron q", "rcommaaccent q"], + ["y e", "y eacute", "y ecaron", "y ecircumflex", "y edieresis", "y edotaccent", "y egrave", "y emacron", "y eogonek", "yacute e", "ydieresis e", "yacute eacute"], + ["y o", "y oacute", "y ocircumflex", "y odieresis", "y oe", "y ograve", "y ohungarumlaut", "y omacron", "y oslash", "y otilde", "yacute o", "ydieresis o", "yacute oacute"], + ["a v", "aacute v", "abreve v", "acircumflex v", "adieresis v", "agrave v", "amacron v", "aogonek v", "aring v", "atilde v"], + ["a w", "aacute w", "abreve w", "acircumflex w", "adieresis w", "agrave w", "amacron w", "aogonek w", "aring w", "atilde w"], + ["c h", "cacute h", "ccaron h", "ccedilla h", "cdotaccent h"], + ["c k", "cacute k", "ccaron k", "ccedilla k", "cdotaccent k"], + ["e x", "eacute x", "ecaron x", "ecircumflex x", "edieresis x", "edotaccent x", "egrave x", "emacron x", "eogonek x"], + ["o w", "oacute w", "ocircumflex w", "odieresis w", "ograve w", "oslash w", "otilde w"], + ["r o", "r oacute", "r ocircumflex", "r odieresis", "r oe", "r ograve", "r ohungarumlaut", "r omacron", "r oslash", "r otilde", "racute o", "rcaron o", "rcommaaccent o", "rcaron oacute"], + ["x e", "x eacute", "x ecaron", "x ecircumflex", "x edieresis", "x edotaccent", "x egrave", "x emacron", "x eogonek"], + ["y a", "y aacute", "y abreve", "y acircumflex", "y adieresis", "y ae", "y agrave", "y amacron", "y aogonek", "y aring", "y atilde", "yacute a", "ydieresis a", "yacute aacute"], + ["r d", "r dcaron", "r dcroat", "racute d", "rcaron d", "rcommaaccent d", "rcaron dcaron"] + ] + kernpairsquotes = [ + # this is far from complete + # TODO: use this list also for accented small caps (using kernfactor) + ["A quotedblright", "A quotedblleft", "Aacute quotedblleft", "Adieresis quotedblleft"], + ["L quotedblright", "L quotedblleft"], # Lcaron and Lacute left out (collision) + ["A quoteright", "A quoteleft", "Aacute quoteleft", "Adieresis quoteleft"], + ["L quoteright", "L quoteleft"], # Lcaron and Lacute left out (collision) + # the following groups look like a nonsense, but all this actually tries to follow the + # idea of correcting just the most critical letters and giving them the same kern value + ["A quotedblright", "quotedblbase V", "quotedblbase W", "quotedblbase Y", "quotedblbase Yacute", "quotedblbase T", "quotedblbase Tcaron"], + ["A quoteright", "quotesinglbase V", "quotesinglbase W", "quotesinglbase Y", "quotesinglbase Yacute", "quotesinglbase T", "quotesinglbase Tcaron"] + ] + rightpunctuationsmall = [ + ["r comma", "racute comma", "rcaron comma", "rcommaaccent comma"], + ["y comma", "yacute comma", "ydieresis comma"], + ["r period", "racute period", "rcaron period", "rcommaaccent period"], + ["y period", "yacute period", "ydieresis period"] + # nothing to be derived from "f quoteright" and "f quotedblright" + ] + def __init__(self, filename): + self.f = open(filename, "a") # append + def writetofile(self, s): + # This method writes one extra kerning pair to the output file. + # It also makes correction for small cap Tcommaaccent and Tcedilla. + # Tcedilla is uni0162 and the small cap is uni0163.SC, not + # uni0162.SC. Tcommaaccent is uni021A and the small cap is uni021B.SC, + # not uni021a.SC (look also at the small "a"; there is problem not only + # in the unicode value, but also in the case, because method lower() is + # used). + self.f.write(s.replace("uni021a.SC", "uni021B.SC").replace("uni0162.SC", "uni0163.SC")) + def smallcaps(self, fromreader, kernfactor): + a = fromreader.getkerns("KPX [A-Z] [A-Z]") + for s in a: + parts = s.split() + self.writetofile("KPX " + parts[1].lower() + ".SC " + parts[2].lower() + + ".SC " + str(int(round(kernfactor * float(parts[3])))) + + '\n') + def initialcap(self, fromreader, kernfactor): + a = fromreader.getkerns("KPX [A-Z] [A-Z]") + for s in a: + parts = s.split() + self.writetofile("KPX " + parts[1] + " " + parts[2].lower() + ".SC " + + str(int(round(kernfactor * float(parts[3])))) + '\n') + def rightpunctuation(self, fromreader, kernfactor): + # small cap and punctuation + a = fromreader.getkerns("KPX [A-Z] period") + a.extend(fromreader.getkerns("KPX [A-Z] comma")) + a.extend(fromreader.getkerns("KPX [A-Z] quotedblright")) + a.extend(fromreader.getkerns("KPX [A-Z] quoteright")) + for s in a: + parts = s.split() + self.writetofile("KPX " + parts[1].lower() + ".SC " + parts[2] + " " + + str(int(round(kernfactor * float(parts[3])))) + '\n') + def leftpunctuation(self, fromreader, kernfactor): + # punctuation and small cap + a = fromreader.getkerns("KPX quotedblleft [A-Z]") + a.extend(fromreader.getkerns("KPX quoteleft [A-Z]")) + for s in a: + parts = s.split() + self.writetofile("KPX " + parts[1] + " " + parts[2].lower() + ".SC " + + str(int(round(kernfactor * float(parts[3])))) + '\n') + def accentedcapitalletters(self, fromreader): + for x in self.kernpairscapital: + basekern = x[0] + derivedkerns = x[1:] + a = fromreader.getkerns("KPX " + basekern + " ") + kernline = a[0] + for b in derivedkerns: + newkernline = kernline.replace(basekern, b) + self.writetofile(newkernline) + def accentedsmallletters(self, fromreader): + for x in self.kernpairssmall: + basekern = x[0] + derivedkerns = x[1:] + a = fromreader.getkerns("KPX " + basekern + " ") + kernline = a[0] + for b in derivedkerns: + newkernline = kernline.replace(basekern, b) + self.writetofile(newkernline) + def accentedsmallcaps(self, fromreader, kernfactor): + for x in self.kernpairscapital: + basekern = x[0] + derivedkerns = x[1:] + a = fromreader.getkerns("KPX " + basekern + " ") + kernline = a[0] + for b in derivedkerns: + newkernline = kernline.replace(basekern, b) + parts = newkernline.split() + self.writetofile("KPX " + parts[1].lower() + ".SC " + parts[2].lower() + + ".SC " + str(int(round(kernfactor * float(parts[3])))) + + '\n') + def accentedinitialcap(self, fromreader): + for x in self.kernpairsinitialcap: + basekern = x[0] + derivedkerns = x[1:] + a = fromreader.getkerns("KPX " + basekern + " ") + kernline = a[0] + for b in derivedkerns: + newkernline = kernline.replace(basekern, b) + self.writetofile(newkernline) + def accentedinitialcapsmallcap(self, fromreader, kernfactor): + for x in self.kernpairscapital: + basekern = x[0] + derivedkerns = x[1:] + a = fromreader.getkerns("KPX " + basekern + " ") + kernline = a[0] + for b in derivedkerns: + newkernline = kernline.replace(basekern, b) + parts = newkernline.split() + self.writetofile("KPX " + parts[1] + " " + parts[2].lower() + ".SC " + + str(int(round(kernfactor * float(parts[3])))) + '\n') + def accentedrightpunctuation(self, fromreader): + for x in self.rightpunctuationsmall: + basekern = x[0] + derivedkerns = x[1:] + a = fromreader.getkerns("KPX " + basekern + " ") + kernline = a[0] + for b in derivedkerns: + newkernline = kernline.replace(basekern, b) + self.writetofile(newkernline) + def accentedleftpunctuation(self, fromreader): + # nothing to be done + pass + def czechquotes(self, fromreader): + for x in self.kernpairsquotes: + basekern = x[0] + derivedkerns = x[1:] + a = fromreader.getkerns("KPX " + basekern + " ") + kernline = a[0] + for b in derivedkerns: + newkernline = kernline.replace(basekern, b) + self.writetofile(newkernline) + def close(self): + self.f.close() + + +kernfactor = 0.94 # width of small caps / width of capital letters; tested for + # letters A, L, T, V, W and Y, all had nearly the same ratio + +fin = KernReader(sys.argv[1]) + +fout = KernWriter(sys.argv[2]) +# letters without accents +fout.smallcaps(fin, kernfactor) +fout.initialcap(fin, kernfactor) +fout.rightpunctuation(fin, kernfactor) +fout.leftpunctuation(fin, kernfactor) +# letters with accents +fout.accentedcapitalletters(fin) +fout.accentedsmallletters(fin) +fout.accentedsmallcaps(fin, kernfactor) +fout.accentedinitialcap(fin) +fout.accentedinitialcapsmallcap(fin, kernfactor) +fout.accentedrightpunctuation(fin) +fout.accentedleftpunctuation(fin) +fout.czechquotes(fin) +fout.close() |