% !TeX program = LuaLaTeX % Copyright (C) 2019-2022 Roberto Giacomelli \documentclass{article} \usepackage{fontspec} \setmainfont{Libertinus Serif} \usepackage[margin=18mm]{geometry} \usepackage{array} \usepackage{booktabs} \newcolumntype{C}{>{\ttfamily}c} \newcolumntype{L}{>{\ttfamily}l} \begin{document} Goal: describe geometrical object like lines and rectangles mainly for a barcode drawing library. \section{\texttt{ga} instruction set} A graphic data specification format called '\texttt{ga}' \emph{graphic alchemy}, or if you want \emph{generic graphic assembler}. \begin{verbatim} ga := generic graphic assembler := numeric type parameter for dimension, for example f64 or i32 := numeric type parameter for quantity, an unsigned integer, i.e. u8 ga := +Elem Elem := Code + Args Code := State | Object | Fn State := 1 -> 31 -- graphic properties Object := 32 -> 239 -- graphic objects Fn := 240 -> 255 -- functions Args : | | | := a dimension value of type DIM := an enumeration value of type u8 (unsigned byte) := an unsigned integer for multiplicity := chars sequence ended with 0 \end{verbatim} \section{Properties} Colors, linecap style etc\dots \noindent\begin{tabular}{CLlL} \toprule OpCode & Mnemonic key & Graphic property & Operands\\ \midrule 1 & pen\_thick & Line thick & \\ 2 & line\_cap\_style & Line cap style & \\ 3 & line\_join\_style & Line join style & \\ 8 & color & ... \\ \midrule 29 & enable\_bbox & start to update the bounding box & -\\ 30 & disable\_bbox & Stop to check the bounding box & -\\ 31 & set\_bbox & Set a bounding box & \\ \bottomrule \end{tabular} \section{Objects} \subsection{Lines} A segment that starts from point P1 (x1, y1) and ends to P2 (x2, y2). \noindent\begin{tabular}{CLlL} \toprule OpCode & Mnemonic key & Graphic object & Operands\\ \midrule 32 & line & Line & \\ 33 & hline & Horizontal line & \\ 34 & vline & Vertical line & \\ \midrule 36 & vbar & Vertical bars & ...\\ 37 & hbar & Horizontal bars & ...\\ \midrule 38 & polyline & Open polyline & ...\\ 39 & c\_polyline & Closed polyline & ...\\ \bottomrule \end{tabular} \subsection{Rectangles} \noindent\begin{tabular}{CLlL} \toprule OpCode & Mnemonic key & Graphic object & Operands\\ \midrule 48 & rect & Rectangle & \\ 49 & f\_rect & Filled rectangle & \\ 50 & rect\_size & Rectangle & \\ 51 & f\_rect\_size & Filled rectangle & \\ \bottomrule \end{tabular} \subsection{Text} \noindent\begin{tabular}{CLl} \toprule OpCode & Mnemonic key & Graphic object/Operands\\ \midrule 130 & text & A text with several glyphs\\ & & \ttfamily \\ \midrule 131 & text\_xspaced & A text with glyphs equally spaced on its vertical axis\\ & & \ttfamily \\ \midrule 132 & text\_xwidth & Glyphs equally spaced on vertical axis between two x coordinates\\ & & \ttfamily \\ \midrule & under design assessment\\ 140 & \_text\_group & Texts on the same baseline \\ & & \ttfamily < > \\ \bottomrule \end{tabular} \subsection{Function} \noindent\begin{tabular}{CLlL} \toprule OpCode & Mnemonic key & Function & Operands\\ \midrule 240 & move & Translate objects & \\ 241 & copy & Copy object & ...\\ 242 & and\_copy & Place and copy objects & ...\\ 243 & grid & Copy next \(n\) objects on a grid & \\ 244 & sl\_grid\\ 250 & mirror\\ 255 & comment & A string comment & \\ \bottomrule \end{tabular} \end{document}