[tex4ht-commits] [SCM] tex4ht updated: r451 - trunk/lit

michal_h21 at gnu.org.ua michal_h21 at gnu.org.ua
Thu Nov 29 16:02:17 CET 2018


Author: michal_h21
Date: 2018-11-29 17:02:17 +0200 (Thu, 29 Nov 2018)
New Revision: 451

Modified:
   trunk/lit/ChangeLog
   trunk/lit/tex4ht-html4.tex
Log:
Added support for webfonts

Modified: trunk/lit/ChangeLog
===================================================================
--- trunk/lit/ChangeLog	2018-11-29 14:09:48 UTC (rev 450)
+++ trunk/lit/ChangeLog	2018-11-29 15:02:17 UTC (rev 451)
@@ -2,6 +2,7 @@
 
 	* tex4ht-html4.tex (html4.4ht): Added \Configure{AddJs} and
 	\Configure{AddCss} for external script and style sheet inclusion.
+	* tex4ht-html4.tex (html4.4ht): Added support for web fonts.
 
 2018-11-24  Karl Berry  <karl at freefriends.org>
 

Modified: trunk/lit/tex4ht-html4.tex
===================================================================
--- trunk/lit/tex4ht-html4.tex	2018-11-29 14:09:48 UTC (rev 450)
+++ trunk/lit/tex4ht-html4.tex	2018-11-29 15:02:17 UTC (rev 451)
@@ -17207,6 +17207,7 @@
    \expandafter\:temp\expandafter{\aa:Css}\Needs{#1}}}
 >>>
 
+\section{External scripts and styles}
 
 \<external scripts and styles\><<<
 
@@ -17221,9 +17222,64 @@
 }
 >>>
 
+\section{Web fonts support}
 
+These commands declare new font family in the CSS file
 
 
+The default font family name which should be used in the Css
+\textit{font-family} command for a declared font is \textit{rmfamily}. 
+It use the Latin Modern font installed on the viewer's system. 
+The Css font family and the local font name can be changed using
+\verb|\Configure{FontFamily}{cssfamilyname}{LocalFontName}| command.
+
+\begin{verbatim}
+\Configure{FontFamily}{rmfamily}{Latin Modern}
+\end{verbatim}
+
+The font shapes can be configure using \verb|\Configure{NormalFont}|, 
+\verb|\Configure{ItalicFont}|, \verb|\Configure{BoldItalicFont}| and
+\verb|Configure{BoldFont}|. The argument should be font file in the format
+supported by browsers, such as \textit{woff} or \textit{otf}.
+
+\begin{verbatim}
+\Configure{NormalFont}{normal-font-file.otf}
+\Configure{BoldFont}{bold-font-file.otf}
+\Configure{BoldItalicFont}{bold-italic-font-file.otf}
+\Configure{ItalicFont}{italic-font-file.otf}
+% Add another font family
+\Configure{FontFamily}{hello}{Linux Libertine O}
+\Configure{NormalFont}{hello-font-file.otf}
+\Css{body{font-family: rmfamily, "AnotherFontFamilyName", serif;}}
+\Css{span.hello{font-family: hello, sans-serif;}}
+\end{verbatim}
+
+\<external web fonts\><<<
+
+\newcommand\AddFontFace[4]{%
+\Css{@font-face {
+    font-family: #1;
+    src: local("#2"),
+        url('#3');
+    #4
+ }}
+ \Configure{Needs}{File: #3}\Needs{}
+}
+
+
+% If more font families are used, they need to have different names
+\NewConfigure{FontFamily}{2}
+
+\Configure{FontFamily}{rmfamily}{Latin Modern}
+
+% Declarations for common font styles, just local family name and font file name are needed to be provided
+\NewConfigure{NormalFont}[1]{\AddFontFace{\a:FontFamily}{\b:FontFamily}{#1}{font-weight: normal;font-style: normal;}}
+\NewConfigure{BoldFont}[1]{\AddFontFace{\a:FontFamily}{\b:FontFamily}{#1}{font-weight: bold;font-style: normal;}}
+\NewConfigure{ItalicFont}[1]{\AddFontFace{\a:FontFamily}{\b:FontFamily}{#1}{font-weight: normal;font-style: italic;}}
+\NewConfigure{BoldItalicFont}[1]{\AddFontFace{\a:FontFamily}{\b:FontFamily}{#1}{font-weight: bold;font-style: italic;}}
+>>>
+
+
 %%%%%%%%%%%%%%%%
 \section{?????}
 %%%%%%%%%%%%%%%%
@@ -20536,6 +20592,7 @@
      |<delay postscript|>}
 
 |<external scripts and styles|>
+|<external web fonts|>
 >>>
 
 



More information about the tex4ht-commits mailing list