[gentium-commits] [SCM] gentium updated: r110 - trunk/gentium/source/fonts/gentium-tug

Pavel Far?? INVALID.NOREPLY at gnu.org.ua
Mon May 9 18:45:30 CEST 2022


Author: pavel
Date: 2022-05-09 16:45:30 +0000 (Mon, 09 May 2022)
New Revision: 110

Modified:
   trunk/gentium/source/fonts/gentium-tug/generate-support-files.rb
   trunk/gentium/source/fonts/gentium-tug/gentium.rb
Log:
generate *.fd files

Modified: trunk/gentium/source/fonts/gentium-tug/generate-support-files.rb
===================================================================
--- trunk/gentium/source/fonts/gentium-tug/generate-support-files.rb	2022-05-08 19:34:09 UTC (rev 109)
+++ trunk/gentium/source/fonts/gentium-tug/generate-support-files.rb	2022-05-09 16:45:30 UTC (rev 110)
@@ -40,6 +40,7 @@
 	# generate 'fd' files
 	if encoding.is_used_in_latex? then
 		encoding.generate_fd
+		encoding.generate_fd_book  # GentiumBookPlus family
 	end
 
 	# generate 'tfm' files

Modified: trunk/gentium/source/fonts/gentium-tug/gentium.rb
===================================================================
--- trunk/gentium/source/fonts/gentium-tug/gentium.rb	2022-05-08 19:34:09 UTC (rev 109)
+++ trunk/gentium/source/fonts/gentium-tug/gentium.rb	2022-05-09 16:45:30 UTC (rev 110)
@@ -278,8 +278,7 @@
 		return "\\DeclareFontShape{#{name_latex_uppercase}}{gentium}{#{width1}}{#{shape1}}{<->ssub * gentium/#{width2}/#{shape2}}{}"
 	end
 	def generate_fd
-		date = "2012/02/06"
-		date = "2011/01/13"
+		date = "2022/05/09"
 
 		filename = "#{name_latex}gentium.fd"
 		File.open(File.join($path_fd,filename), 'w') do |file|
@@ -321,6 +320,59 @@
 		end
 	end
 
+	# TODO: (Pavel) Merge the following 3 methods with the previous 3 methods
+	def declare_font_shape_book(width, shape, name)
+		text = "\\DeclareFontShape{#{name_latex_uppercase}}{gentiumbook}{#{width}}{#{shape}}{\n" +
+			"            <->     \\gentiumbook@@scale #{@name}-gentium#{name}\n" +
+			"}{}\n\n"
+		return text
+	end
+	def declare_font_shape_sub_book(width1, shape1, width2, shape2)
+		return "\\DeclareFontShape{#{name_latex_uppercase}}{gentiumbook}{#{width1}}{#{shape1}}{<->ssub * gentiumbook/#{width2}/#{shape2}}{}"
+	end
+	def generate_fd_book
+		date = "2022/05/09"
+
+		filename = "#{name_latex}gentiumbook.fd"
+		File.open(File.join($path_fd,filename), 'w') do |file|
+			file.puts "\\ProvidesFile{#{name_latex}gentiumbook.fd}"
+			file.puts "    [#{date} Font definitions for gentiumbook.]"
+			file.puts
+			file.puts '\expandafter\ifx\csname gentiumbook at scale\endcsname\relax'
+			file.puts '    \let\gentiumbook@@scale\@empty'
+			file.puts '\else'
+			file.puts '    \edef\gentiumbook@@scale{s*[\csname gentiumbook at scale\endcsname]}%'
+			file.puts '\fi'
+			file.puts
+			file.puts "\\DeclareFontFamily{#{name_latex_uppercase}}{gentiumbook}{}"
+			file.puts
+			file.puts declare_font_shape_book("m", "n",  "book-regular")
+			file.puts declare_font_shape_book("m", "it", "book-italic")
+			if has_bold? then
+				file.puts declare_font_shape_book("b", "n",  "book-bold")
+				file.puts declare_font_shape_book("b", "it", "book-bolditalic")
+				# TODO: set the correct tfm names in the following two lines
+				if has_smallcaps? then
+					file.puts declare_font_shape_book("m", "sc",   "book-regular-sc")
+					file.puts declare_font_shape_book("m", "scit", "book-italic-sc")
+					file.puts declare_font_shape_book("b", "sc",   "book-bold-sc")
+					file.puts declare_font_shape_book("b", "scit", "book-bolditalic-sc")
+				end
+				# TODO: a clever algorithm to do replacements instead
+				# TODO: (Pavel) Look at substitutions (bold, small caps)
+				file.puts declare_font_shape_sub_book("m",  "sl", "m", "it")
+				file.puts declare_font_shape_sub_book("b",  "sl", "b", "it")
+				file.puts declare_font_shape_sub_book("bx", "sl", "b", "it")
+				file.puts declare_font_shape_sub_book("bx", "it", "b", "it")
+				file.puts declare_font_shape_sub_book("bx", "n",  "b", "n")
+			else
+				file.puts declare_font_shape_sub_book("m",  "sl", "m", "it")
+			end
+			file.puts
+			file.puts '\endinput'
+		end
+	end
+
 	attr_reader :name
 end
 



More information about the gentium-commits mailing list.