Little Lorem

Random characters from a specific script

Advertisements

Place-filling text (lorem ipsum) to give an idea of what a page layout would look like has a long pedigree and TeX can do it well.

Sometimes an idea of what characters in a specific script would look like is also needed.

textlipsum

Here’s some TeX code for that (it started off as displaying random Chinese characters [by egreg on stackexchange in 2011], but has been expanded to handle any Unicode block as requested):

%Random text by script

\documentclass[a4paper]{article}

%\errorcontextlines 10000 %for getting fuller error messages

\usepackage{geometry}

\geometry{margin=2cm,heightrounded}

\usepackage{fontspec}

\setmainfont{Cambria}

\usepackage{xcolor}

\usepackage{soul}

\input{random}

\newcount\cjkcharcnt

%\random=3

%-------------------------- customised section:

% Yi block

\newcommand\yistartc{"A000}

\newcommand\yistopc{"A48C}

% Linear A block

\newcommand\linastartc{"10600}

\newcommand\linastopc{"10726}

% Linear B syllabary block

\newcommand\linbsstartc{"10000}

\newcommand\linbsstopc{"1005D}

% Linear B ideograms block

\newcommand\linbistartc{"10080}

\newcommand\linbistopc{"100FA}

% Vai block

\newcommand\vaistartc{"A500}

\newcommand\vaistopc{"A62B}

% Miscsellaneous symbols, emoticons, etc blocks

\newcommand\iconstartc{"1F300}

\newcommand\iconstopc{"1F6D2}

% Tangut Components block

\newcommand\tangutcomstartc{"18800}

\newcommand\tangutcomstopc{"18AF2}

% Tangut block

\newcommand\tangutstartc{"17000}

\newcommand\tangutstopc{"187EC}

% Bamum block

\newcommand\bamumstartc{"16800}

\newcommand\bamumstopc{"16A38}

% Anatolian hieroglyphs block

\newcommand\anatolianstartc{"14400}

\newcommand\anatolianstopc{"14646}

% Egyptian hieroglyphs block

\newcommand\egyptianstartc{"13000}

\newcommand\egyptianstopc{"1342E}

% CJK part block

\newcommand\cjkstartc{"4E00}

\newcommand\cjkstopc{"9FBB}

% Phaistos Disc block

\newcommand\phaistosstartc{"101D0}

\newcommand\phaistosstopc{"101FD}

%Cuneiform block

\newcommand\cuneiformstartc{"12000}

\newcommand\cuneiformstopc{"12399}

%

\newcounter{startc}

\newcounter{stopc}

%--------------------------------------------------------------------

% url= https://tex.stackexchange.com/questions/20409/how-to-create-a-table-of-random-characters-in-xetex

% question = How to create a table of random characters in XeTeX:

% "I want to create a table of 1000 characters picked randomly from the unicode block "unified CJK ideograms" (4E00-9FFF). Each cell should contain exactly one huge character, no character should appear twice."

% answer = answered Jun 10 '11 at 16:18 by egreg

\newif\ifshownumbers

\def\cjkchar{\setrannum{\cjkcharcnt}{\thestartc}{\thestopc}%

\ifcsname CJK\the\cjkcharcnt\endcsname

\message{Recomputing (collision)}\let\next\cjkchar

\else

\expandafter\let\csname CJK\the\cjkcharcnt\endcsname\empty

\ifshownumbers{\footnotesize(\number\cjkcharcnt) }\fi

\ifnum\XeTeXcharglyph\cjkcharcnt=00

\message{Recomputing (missing character)}\let\next\cjkchar

\else

\char\cjkcharcnt\let\next\relax

\fi

\fi

\next}

\newcommand{\row}{\hbox to\hsize{%

\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil

\ifshownumbers\else

\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil

\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil

\fi

\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil\cjkchar\hfil\cjkchar}}

%----------------------------------------------------------

%Parameters:

%scriptname, fontname, startcharactervalue, stopcharactervalue

\newcommand\dosample[4]{%

\newfontface\ver{#2}

\setcounter{startc}{#3}

\setcounter{stopc}{#4}

\section{#1}

This is a sample of #1 (in \hl{\texttt{#2}} font): \par

{\huge \ver \row\row\row}

}

%----------------------------------------------------------

\begin{document}

\tableofcontents

%\shownumberstrue % uncomment to show (decimal) numbers

\dosample{Yi}{Noto Sans Yi}{\yistartc}{\yistopc}

\dosample{Linear A}{Aegean}{\linastartc}{\linastopc}

\dosample{Vai}{Dukor}{\vaistartc}{\vaistopc}

\dosample{Icons etc}{Code2003}{\iconstartc}{\iconstopc}

\dosample{Tangut Components}{Tangut Yinchuan}{\tangutcomstartc}{\tangutcomstopc}

\dosample{Tangut}{Tangut Yinchuan}{\tangutstartc}{\tangutstopc}

\dosample{Bamum}{Noto Sans Bamum}{\bamumstartc}{\bamumstopc}

\dosample{Anatolian hieroglyphs}{Anatolian}{\anatolianstartc}{\anatolianstopc}

\dosample{Egyptian hierglyphs}{Aegyptus}{\egyptianstartc}{\egyptianstopc}

\dosample{CJK ideographs}{SimSun}{\cjkstartc}{\cjkstopc}

\dosample{Linear B syllabary}{Aegean}{\linbsstartc}{\linbsstopc}

\dosample{Linear B ideograms}{Aegean}{\linbistartc}{\linbistopc}

\dosample{Phaistos Disc}{Aegean}{\phaistosstartc}{\phaistosstopc}

\dosample{Cuneiform}{Akkadian}{\cuneiformstartc}{\cuneiformstopc}

%\row\row\row\row\row\row\row

%\row\row\row\row\row\row\row\row\row\row

%\row\row\row\row\row\row\row\row\row\row

%\row\row\row\row\row\row\row\row\row\row

%\row\row\row\row\row\row\row\row\row\row

%\ifshownumbers

% \row\row\row\row\row\row\row\row\row\row

% \row\row\row\row\row\row\row\row\row\row

% \row\row\row\row\row\row\row\row\row\row

% \row\row\row\row\row\row\row\row\row\row

% \row\row\row\row\row\row\row\row\row\row

%\fi

\end{document}