diff options
author | Karl Berry <karl@freefriends.org> | 2020-11-09 22:05:45 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-11-09 22:05:45 +0000 |
commit | 7c9ecc221f4157ec02e93fe878fd552e6c1b2119 (patch) | |
tree | b2e5d3dbe9e8d56c1bf38fe7d2259557701faf86 /Master/texmf-dist/doc/fonts/rojud | |
parent | 1bbe1fda66b5a41afd1b8c1d289232aed019fb2e (diff) |
rojud (9nov20)
git-svn-id: svn://tug.org/texlive/trunk@56895 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/fonts/rojud')
-rw-r--r-- | Master/texmf-dist/doc/fonts/rojud/README.txt | 13 | ||||
-rw-r--r-- | Master/texmf-dist/doc/fonts/rojud/rojud.pdf | bin | 0 -> 182730 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/fonts/rojud/rojud.tex | 198 | ||||
-rw-r--r-- | Master/texmf-dist/doc/fonts/rojud/rows.tex | 12 |
4 files changed, 223 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/fonts/rojud/README.txt b/Master/texmf-dist/doc/fonts/rojud/README.txt new file mode 100644 index 00000000000..e34f4a105a5 --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/fonts/rojud/rojud.pdf b/Master/texmf-dist/doc/fonts/rojud/rojud.pdf Binary files differnew file mode 100644 index 00000000000..b1bc77c4eca --- /dev/null +++ b/Master/texmf-dist/doc/fonts/rojud/rojud.pdf diff --git a/Master/texmf-dist/doc/fonts/rojud/rojud.tex b/Master/texmf-dist/doc/fonts/rojud/rojud.tex new file mode 100644 index 00000000000..97c7b976b88 --- /dev/null +++ b/Master/texmf-dist/doc/fonts/rojud/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/Master/texmf-dist/doc/fonts/rojud/rows.tex b/Master/texmf-dist/doc/fonts/rojud/rows.tex new file mode 100644 index 00000000000..9fc11d475a6 --- /dev/null +++ b/Master/texmf-dist/doc/fonts/rojud/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} \\ |