From 9a05879c627e3f960a2d0645b07dfb25eca005d8 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 10 Nov 2020 03:01:41 +0000 Subject: CTAN sync 202011100301 --- fonts/rojud/README.txt | 13 +++ fonts/rojud/doc/rojud.pdf | Bin 0 -> 182730 bytes fonts/rojud/doc/rojud.tex | 198 ++++++++++++++++++++++++++++++++++++++++++ fonts/rojud/doc/rows.tex | 12 +++ fonts/rojud/latex/ot1rojud.fd | 4 + fonts/rojud/latex/rojud.sty | 107 +++++++++++++++++++++++ fonts/rojud/latex/turojud.fd | 4 + fonts/rojud/map/rojud.map | 1 + fonts/rojud/tfm/rojud.tfm | Bin 0 -> 544 bytes fonts/rojud/type1/rojud.pfb | Bin 0 -> 331701 bytes 10 files changed, 339 insertions(+) create mode 100644 fonts/rojud/README.txt create mode 100644 fonts/rojud/doc/rojud.pdf create mode 100644 fonts/rojud/doc/rojud.tex create mode 100644 fonts/rojud/doc/rows.tex create mode 100644 fonts/rojud/latex/ot1rojud.fd create mode 100644 fonts/rojud/latex/rojud.sty create mode 100644 fonts/rojud/latex/turojud.fd create mode 100644 fonts/rojud/map/rojud.map create mode 100644 fonts/rojud/tfm/rojud.tfm create mode 100644 fonts/rojud/type1/rojud.pfb (limited to 'fonts') diff --git a/fonts/rojud/README.txt b/fonts/rojud/README.txt new file mode 100644 index 0000000000..e34f4a105a --- /dev/null +++ b/fonts/rojud/README.txt @@ -0,0 +1,13 @@ +The 'rojud' package (version 1.2) provides a Type-1 Font for the 42 counties of Romania. + +I started from an administrative map of the country (a .shp file, from https://gadm.org/); using R (https://www.r-project.org/) and 'sp' package, extracted the counties contours (in geographic coordinates) and projected them to the cartezian plane (by UTM zones); these contours were excesively long, so I used the 'mapshaper' library (https://github.com/mbloch/mapshaper) to simplify them. + +With a R program, these simplified contours were transformed in PS procedures for producing the glyphs; then I collected and adapted these procedures in a "Type1"-format raw file, transformed in final in the '.pfb' font-file by using the 't1asm' program (https://ctan.org/pkg/t1utils). + +This work is subject to the LaTeX Project Public License (http://www.latex-project.org/lppl.txt). + + +Vlad Bazon +vlad.bazon@gmail.com + + diff --git a/fonts/rojud/doc/rojud.pdf b/fonts/rojud/doc/rojud.pdf new file mode 100644 index 0000000000..b1bc77c4ec Binary files /dev/null and b/fonts/rojud/doc/rojud.pdf differ diff --git a/fonts/rojud/doc/rojud.tex b/fonts/rojud/doc/rojud.tex new file mode 100644 index 0000000000..97c7b976b8 --- /dev/null +++ b/fonts/rojud/doc/rojud.tex @@ -0,0 +1,198 @@ +\documentclass[a4paper,11pt]{article} +\usepackage{rojud} +\title{rojud \\[.25cm] + \normalsize{a Type-1 Font for the 42 counties of Romania} +} +\author{Vlad Bazon\footnote{\texttt{vlad.bazon@gmail.com}} +} +\date{\normalsize{November 2020}} + + \newcommand{\setFont}[1]{\fontfamily{#1}\selectfont} + \newcommand\Sj[1]{\setFont{rojud}\Huge\paintt{#1}} + \newcommand\Sn[1]{\footnotesize\texttt{#1}} + +\usepackage{ifthen} + +\usepackage[no-math]{fontspec} +\setmainfont{texgyrepagella-regular.otf}[ + BoldFont = texgyrepagella-bold.otf , + ItalicFont = texgyrepagella-italic.otf , + BoldItalicFont = texgyrepagella-bolditalic.otf, + Scale=MatchUppercase, + Mapping=tex-text +] +\setsansfont{texgyreheros-regular.otf}[ + BoldFont = texgyreheros-bold.otf, + ItalicFont = texgyreheros-italic.otf, + BoldItalicFont = texgyreheros-bolditalic.otf, + SmallCapsFont = texgyreheroscn-regular.otf, + SmallCapsFeatures={Letters=SmallCaps}, + Scale=1 +] +\setmonofont{DejaVu Sans Mono}[Scale=MatchLowercase] +\strongfontdeclare{\bfseries,\fontseries{m}\selectfont} + +\begin{document} +\maketitle + +\begin{abstract} +The idea of a font with the "images" of a given set of geographic regions is seeded in the \textsf{CountriesOfEurope} font (see \cite{CoE}), which---as other about 3700 Type-1 fonts in TexLive distribution---is stamped as "\emph{\% Generated by FontForge}". But how one can \emph{construct} a such font? We describe and apply a general procedure for that. +\end{abstract} + +\section{The counties as glyphs} + +From \textsf{GADM} (\cite{GADM}) we obtain the administrative map of the country, as a \emph{shapefile} file; this file contain ''polygons'' for each county, which are closed \emph{paths} {\small(speaking as in Postscript)} expressed in geographic coordinates. With a \strong{R} program (\cite{R}), using the \strong{\textsf{sp}} package, we extract the counties contours and project them to cartezian coordinates by \textsf{UTM}\footnote{https://en.wikipedia.org/wiki/Universal\_Transverse\_Mercator\_coordinate\_system} {\small(having into account that not all counties maps to the same \textsf{UTM}-zone)}. The respective paths usually contains very many points {\small(and we will have to keep in mind the Postscript \textsf{\emph{limitcheck}} barrier)}; so we use the javaScript \strong{\textsf{mapshaper}} library (\cite{mapshaper}) for to simplify the contours {\small(in the Romania case is sufficient 18\% of the initial vertices)}. + +The contours so obtained could be traced or painted in a Ghostscript session, using \texttt{moveto} and \texttt{lineto}; but in the Type-1 font-file we need to use the relative alternative of these, \texttt{rmoveto} and \texttt{rlineto}. So by a \strong{R} program we transform the coordinates matrix of each contour, replacing each line with its difference from the previous one; therewith by this \strong{R} program, we formulate a ''\textsf{.raw}'' file, in which we write these matrixes completed on every line by a "rlineto" word {\small(excepting the first line, where we have "rmoveto", and the last line which is replaced by word "closepath")}. + +More precisely, in this ''\textsf{.raw}'' file we obtain, for each county, the needed glyph definition in the terms of the Type-1 format, for example: + +{\small +\begin{verbatim} +/jAB { % judeţul Alba (Alba county) +0 1204 hsbw % "horizontal sidebearing and width" +74881 100 div 4378 100 div rmoveto +-634 100 div -958 100 div rlineto +-492 100 div -105 100 div rlineto + % etc. +861 100 div -86 100 div rlineto +1067 100 div 293 100 div rlineto +closepath +endchar +} ND %% total: 979 rows +\end{verbatim} +} + +Then we insert in this ''\textsf{.raw}'' file the \texttt{/CharStrings} dictionary definition, the \texttt{/Encoding} definition, etc. -- having at beginning {\small(see \cite{PLRM})}: + +{\small +\begin{verbatim} +7 dict begin +/FontType 1 def +/FontMatrix [0.001 0 0 0.001 0 0] readonly def +/FontName /rojud def +/FontBBox {0 0 1776 1375} readonly def +/PaintType 0 def +\end{verbatim} +} + +and ending the ''\textsf{.raw}'' file {\small(about 77700 lines)} by: + +{\small +\begin{verbatim} +end end +readonly put +put +dup/FontName get exch definefont pop +mark currentfile closefile +cleartomark +\end{verbatim} +} + +From this ''\textsf{.raw}'' file we obtain the desired \textsf{.pfb} file, using the \strong{\textsf{t1asm}} program (\cite{t1asm}). + +\smallskip +Using \textsf{pf2afm.ps} from \cite{GS} {\small(or an ''on-line converter'')} we obtain the corresponding metric file ''\textsf{.afm}'', from which using \textsf{afm2pl} and \textsf{pltotf}, we obtain the needed for TeX metric file ''\textsf{.tfm}''. For the package definition of the new font what else is needed is to add the ''\textsf{.fd}'' and ''\textsf{.sty}'' files; of course, these files {\small(\texttt{.pfb}, \texttt{.tfm}, \texttt{.map}, \texttt{.fd} and \texttt{.sty})} must be incorporated in the appropriate places of the TeXLive directory structure. + +\smallskip +Actually we add two minimal ''\textsf{.fd}'' files, ''\texttt{TUrojud.fd}'' for \textsf{xelatex} and ''\texttt{OT1rojud.fd}'' for \textsf{pdflatex}; in the ''\textsf{.sty}'' file we separate by these cases the symbol declarations and we add a single new command, ''\texttt{\textbackslash{}paintt}'', which use the \texttt{\textbackslash{}special} TeX primitive for to paint the glyph in the PDF ''\emph{FillAndStroke}'' rendering mode {\small(but fixing the colours, at a perhaps decent level)}. + +\section{Tests (simple examples)} + +We don't see a practical use for such a font, whose glyphs shape some geographical regions\ldots{} the interesting issue is their very definition in the font file, described above. + +\smallskip +But for simple tests or some examples, consider in the preamble of a LaTeX file \texttt{usepackage\{rojud\}} and let's say, these simplifying commands: + +{\small +\begin{verbatim} + \newcommand{\setFont}[1]{\fontfamily{#1}\selectfont} + \newcommand\Sj[1]{\setFont{rojud}\Huge\paintt{#1}} + \newcommand\Sn[1]{\footnotesize\texttt{#1}} +\end{verbatim} +} + +It is easy to write a litle Python script to generate a TeX file "rows.tex", giving the rows and columns {\small(with cells \texttt{\textbackslash{}Sj} and \texttt{\textbackslash{}Sn}, applied to glyphs)} of a \texttt{\textbackslash{}tabular} environment; then \texttt{\textbackslash{}include rows.tex} in this environment of the initial LaTeX file {\small(see the TeX source of this document)}, to present the glyphs as follows: + +{\centerline{Fontul \textbf{rojud} {\small(judeţele României)}}} +\fbox{ +\begin{tabular}{*{7}{c}} + \input{rows.tex} +\end{tabular} +} + +\bigskip +Repeating \verb!{\fbox{\paintt{\symbol{\value{N}}}}}!, with \texttt{N} from 167 to 208 {\small(the codes from the \texttt{/Encoding} table of the font)} we could produce the glyphs engraved in his bounding boxes {\small(here with \verb!\huge!)}: + +\smallskip +{ +\setFont{rojud} +\fboxsep=0pt +\newcounter{N} +\setcounter{N}{167} +\huge\noindent +\whiledo{\value{N}<181}{% + \fbox{\paintt{\symbol{\value{N}}}}% + \stepcounter{N}}% +\par\smallskip\noindent +\whiledo{\value{N}<195}{% + \fbox{\paintt{\symbol{\value{N}}}}% + \stepcounter{N}}% +\par\smallskip\noindent +\whiledo{\value{N}<209}{% + \fbox{\paintt{\symbol{\value{N}}}}% + \stepcounter{N}}% +} + +\medskip +Lastly, we produce a litle paragraph of text---in romanian language, at \verb!\small!, \verb!\normalsize! and \verb!\large!---integrating a few glyphs: + +\renewcommand\Sj[1]{{\fontfamily{rojud}\selectfont\paintt{#1}}} + +\smallskip +{\small +,,\paintt{Judeţul Iaşi} \Sj{\jIS} se învecinează cu judeţele Botoşani \Sj{\jBT} spre nord, Suceava \Sj{\jSV} spre nord-vest, Neamţ \Sj{\jNT} spre vest şi cu Vaslui \Sj{\jVS} spre sud.''} + +\smallskip +{\normalsize +,,\paintt{Judeţul Iaşi} \Sj{\jIS} se învecinează cu judeţele Botoşani \Sj{\jBT} spre nord, Suceava \Sj{\jSV} spre nord-vest, Neamţ \Sj{\jNT} spre vest şi cu Vaslui \Sj{\jVS} spre sud.''} + +\smallskip +{\large +,,\paintt{Judeţul Iaşi} \Sj{\jIS} se învecinează cu judeţele Botoşani \Sj{\jBT} spre nord, Suceava \Sj{\jSV} spre nord-vest, Neamţ \Sj{\jNT} spre vest ...''} + +\smallskip +\renewcommand\Sj[1]{{\setFont{rojud}{#1}}} +{\noindent\normalsize +,,\emph{The neighboring counties with \Sj{\jIS} are: \Sj{\jBT}, \Sj{\jSV}, \Sj{\jNT} and \Sj{\jVS}.}''} + +\medskip +We must note here that in the bounding boxes of the county glyphs we did not leave the usual extra horizontal space {\small(to separate two neighboring glyphs)}; usually these irregular glyphs will appear in a text interspersed with characters of an another font {\small(an not as neighbors)}. \\ +Also note that (implicitly by the above construction) the county glyphs respects {\small(as possible)} the cartographic proportions of the counties. + + +\begin{thebibliography}{10} +\addtolength{\leftmargin}{0.2in} +\setlength{\itemindent}{-0.2in} + +\bibitem{CoE} \textsf{https://ctan.org/pkg/countriesofeurope} \\ +{\small\emph{A font with the images of the countries of Europe}} + +\bibitem{GADM} \textsf{https://gadm.org} \quad{\small\emph{the Database of Global Administrative Areas}} + +\bibitem{R} \textsf{https://www.r-project.org/} \\ +{\small\emph{a free software environment for statistical computing and graphics}} + +\bibitem{mapshaper} \textsf{https://github.com/mbloch/mapshaper} \\ +\quad{\small\emph{A tool for topologically aware shape simplification}} + +\bibitem{t1asm} \textsf{https://ctan.org/pkg/t1utils} \\ +{\small\emph{Simple Type 1 font manipulation programs}} + +\bibitem{PLRM} \textsf{https://www.adobe.com/jp/print/postscript/pdfs/PLRM.pdf} + +\bibitem{GS} \textsf{https://www.ghostscript.com/} + +\end{thebibliography} + +\end{document} diff --git a/fonts/rojud/doc/rows.tex b/fonts/rojud/doc/rows.tex new file mode 100644 index 0000000000..9fc11d475a --- /dev/null +++ b/fonts/rojud/doc/rows.tex @@ -0,0 +1,12 @@ +\Sj{\jAB} & \Sj{\jAR} & \Sj{\jAG} & \Sj{\jBC} & \Sj{\jBH} & \Sj{\jBN} & \Sj{\jBT} \\ +\Sn{AB} & \Sn{AR} & \Sn{AG} & \Sn{BC} & \Sn{BH} & \Sn{BN} & \Sn{BT} \\ +\Sj{\jBV} & \Sj{\jBR} & \Sj{\jBI} & \Sj{\jBZ} & \Sj{\jCL} & \Sj{\jCS} & \Sj{\jCJ} \\ +\Sn{BV} & \Sn{BR} & \Sn{BI} & \Sn{BZ} & \Sn{CL} & \Sn{CS} & \Sn{CJ} \\ +\Sj{\jCT} & \Sj{\jCV} & \Sj{\jDB} & \Sj{\jDJ} & \Sj{\jGL} & \Sj{\jGR} & \Sj{\jGJ} \\ +\Sn{CT} & \Sn{CV} & \Sn{DB} & \Sn{DJ} & \Sn{GL} & \Sn{GR} & \Sn{GJ} \\ +\Sj{\jHR} & \Sj{\jHD} & \Sj{\jIS} & \Sj{\jIL} & \Sj{\jIF} & \Sj{\jMM} & \Sj{\jMH} \\ +\Sn{HR} & \Sn{HD} & \Sn{IS} & \Sn{IL} & \Sn{IF} & \Sn{MM} & \Sn{MH} \\ +\Sj{\jMS} & \Sj{\jNT} & \Sj{\jOT} & \Sj{\jPH} & \Sj{\jSJ} & \Sj{\jSM} & \Sj{\jSB} \\ +\Sn{MS} & \Sn{NT} & \Sn{OT} & \Sn{PH} & \Sn{SJ} & \Sn{SM} & \Sn{SB} \\ +\Sj{\jSV} & \Sj{\jTR} & \Sj{\jTM} & \Sj{\jTL} & \Sj{\jVL} & \Sj{\jVS} & \Sj{\jVN} \\ +\Sn{SV} & \Sn{TR} & \Sn{TM} & \Sn{TL} & \Sn{VL} & \Sn{VS} & \Sn{VN} \\ diff --git a/fonts/rojud/latex/ot1rojud.fd b/fonts/rojud/latex/ot1rojud.fd new file mode 100644 index 0000000000..c493516ea7 --- /dev/null +++ b/fonts/rojud/latex/ot1rojud.fd @@ -0,0 +1,4 @@ +%\ProvidesFile{ot1rojud.fd} +\DeclareFontFamily{OT1}{rojud}{} +\DeclareFontShape{OT1}{rojud}{m}{n}{<-> rojud}{} + diff --git a/fonts/rojud/latex/rojud.sty b/fonts/rojud/latex/rojud.sty new file mode 100644 index 0000000000..c458f4df21 --- /dev/null +++ b/fonts/rojud/latex/rojud.sty @@ -0,0 +1,107 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{rojud}[2020/10/25 rojud, Type 1 Font; XeLaTeX / PDFLaTeX] +\RequirePackage{iftex} + +\ifxetex +\DeclareFontEncoding{TU}{}{} +\DeclareTextSymbol{\jAB}{TU}{167} +\DeclareTextSymbol{\jAR}{TU}{168} +\DeclareTextSymbol{\jAG}{TU}{169} +\DeclareTextSymbol{\jBC}{TU}{170} +\DeclareTextSymbol{\jBH}{TU}{171} +\DeclareTextSymbol{\jBN}{TU}{172} +\DeclareTextSymbol{\jBT}{TU}{173} +\DeclareTextSymbol{\jBV}{TU}{174} +\DeclareTextSymbol{\jBR}{TU}{175} +\DeclareTextSymbol{\jBI}{TU}{176} +\DeclareTextSymbol{\jBZ}{TU}{177} +\DeclareTextSymbol{\jCL}{TU}{178} +\DeclareTextSymbol{\jCS}{TU}{179} +\DeclareTextSymbol{\jCJ}{TU}{180} +\DeclareTextSymbol{\jCT}{TU}{181} +\DeclareTextSymbol{\jCV}{TU}{182} +\DeclareTextSymbol{\jDB}{TU}{183} +\DeclareTextSymbol{\jDJ}{TU}{184} +\DeclareTextSymbol{\jGL}{TU}{185} +\DeclareTextSymbol{\jGR}{TU}{186} +\DeclareTextSymbol{\jGJ}{TU}{187} +\DeclareTextSymbol{\jHR}{TU}{188} +\DeclareTextSymbol{\jHD}{TU}{189} +\DeclareTextSymbol{\jIS}{TU}{190} +\DeclareTextSymbol{\jIL}{TU}{191} +\DeclareTextSymbol{\jIF}{TU}{192} +\DeclareTextSymbol{\jMM}{TU}{193} +\DeclareTextSymbol{\jMH}{TU}{194} +\DeclareTextSymbol{\jMS}{TU}{195} +\DeclareTextSymbol{\jNT}{TU}{196} +\DeclareTextSymbol{\jOT}{TU}{197} +\DeclareTextSymbol{\jPH}{TU}{198} +\DeclareTextSymbol{\jSJ}{TU}{199} +\DeclareTextSymbol{\jSM}{TU}{200} +\DeclareTextSymbol{\jSB}{TU}{201} +\DeclareTextSymbol{\jSV}{TU}{202} +\DeclareTextSymbol{\jTR}{TU}{203} +\DeclareTextSymbol{\jTM}{TU}{204} +\DeclareTextSymbol{\jTL}{TU}{205} +\DeclareTextSymbol{\jVL}{TU}{206} +\DeclareTextSymbol{\jVS}{TU}{207} +\DeclareTextSymbol{\jVN}{TU}{208} +\newcommand{\paintt}[1]{% + \special{pdf:literal direct .86 g .1 w 2 Tr}% + #1% fill with .8 gray, stroked with current color + \special{pdf:literal 0 g 0 Tr}% +} +\else +\ifpdftex +\DeclareFontEncoding{OT1}{}{} +\DeclareTextSymbol{\jAB}{OT1}{167} +\DeclareTextSymbol{\jAR}{OT1}{168} +\DeclareTextSymbol{\jAG}{OT1}{169} +\DeclareTextSymbol{\jBC}{OT1}{170} +\DeclareTextSymbol{\jBH}{OT1}{171} +\DeclareTextSymbol{\jBN}{OT1}{172} +\DeclareTextSymbol{\jBT}{OT1}{173} +\DeclareTextSymbol{\jBV}{OT1}{174} +\DeclareTextSymbol{\jBR}{OT1}{175} +\DeclareTextSymbol{\jBI}{OT1}{176} +\DeclareTextSymbol{\jBZ}{OT1}{177} +\DeclareTextSymbol{\jCL}{OT1}{178} +\DeclareTextSymbol{\jCS}{OT1}{179} +\DeclareTextSymbol{\jCJ}{OT1}{180} +\DeclareTextSymbol{\jCT}{OT1}{181} +\DeclareTextSymbol{\jCV}{OT1}{182} +\DeclareTextSymbol{\jDB}{OT1}{183} +\DeclareTextSymbol{\jDJ}{OT1}{184} +\DeclareTextSymbol{\jGL}{OT1}{185} +\DeclareTextSymbol{\jGR}{OT1}{186} +\DeclareTextSymbol{\jGJ}{OT1}{187} +\DeclareTextSymbol{\jHR}{OT1}{188} +\DeclareTextSymbol{\jHD}{OT1}{189} +\DeclareTextSymbol{\jIS}{OT1}{190} +\DeclareTextSymbol{\jIL}{OT1}{191} +\DeclareTextSymbol{\jIF}{OT1}{192} +\DeclareTextSymbol{\jMM}{OT1}{193} +\DeclareTextSymbol{\jMH}{OT1}{194} +\DeclareTextSymbol{\jMS}{OT1}{195} +\DeclareTextSymbol{\jNT}{OT1}{196} +\DeclareTextSymbol{\jOT}{OT1}{197} +\DeclareTextSymbol{\jPH}{OT1}{198} +\DeclareTextSymbol{\jSJ}{OT1}{199} +\DeclareTextSymbol{\jSM}{OT1}{200} +\DeclareTextSymbol{\jSB}{OT1}{201} +\DeclareTextSymbol{\jSV}{OT1}{202} +\DeclareTextSymbol{\jTR}{OT1}{203} +\DeclareTextSymbol{\jTM}{OT1}{204} +\DeclareTextSymbol{\jTL}{OT1}{205} +\DeclareTextSymbol{\jVL}{OT1}{206} +\DeclareTextSymbol{\jVS}{OT1}{207} +\DeclareTextSymbol{\jVN}{OT1}{208} +\newcommand{\paintt}[1]{% + \pdfliteral direct{0.86 g 2 Tr .1 w}% + #1% fill with .8 gray, stroked with current color + \pdfliteral direct{0 g 0 Tr}% +} +\fi +\fi +\endinput + diff --git a/fonts/rojud/latex/turojud.fd b/fonts/rojud/latex/turojud.fd new file mode 100644 index 0000000000..27681ae372 --- /dev/null +++ b/fonts/rojud/latex/turojud.fd @@ -0,0 +1,4 @@ +%\ProvidesFile{turojud.fd} +\DeclareFontFamily{TU}{rojud}{} +\DeclareFontShape{TU}{rojud}{m}{n}{<-> rojud}{} + diff --git a/fonts/rojud/map/rojud.map b/fonts/rojud/map/rojud.map new file mode 100644 index 0000000000..295b0721e5 --- /dev/null +++ b/fonts/rojud/map/rojud.map @@ -0,0 +1 @@ +rojud rojud