|
That Terminal
A terminal emulator designed for video making purposes.
|
Contains low-level functions for parsing font files. Used by ReadFontsList and FontPlan. More...
#include <regex>#include <fstream>#include <unordered_map>#include <mutex>#include <set>#include "read_font.hh"#include "gunzip.hh"#include "endian.hh"#include "share.hh"
Classes | |
| struct | PSFheader |
Macros | |
| #define | r(str) rmatch<__LINE__>(str##sv, mat, line) |
Functions | |
| std::vector< char32_t > | BDFtranslateToUnicode (int index, std::string_view reg, std::string_view enc) |
| std::string | ReadGZ (std::string_view filename) |
| PSFheader | ReadPSFheader (const char *data) |
| std::multimap< std::size_t, char32_t > | Read_PSFgzEncoding (std::string_view data, const PSFheader &h) |
| std::multimap< std::size_t, char32_t > | Read_PSFgzEncoding (std::string_view filename) |
| GlyphList | Read_PSFgz (std::string_view filename, unsigned, unsigned, std::string_view assume_encoding) |
| GlyphList | Read_BDF (std::string_view filename, unsigned width, unsigned, std::string_view guess_encoding) |
| GlyphList | Read_Inc (std::string_view filename, unsigned width, unsigned height, std::string_view guess_encoding) |
| GlyphList | Read_ASM (std::string_view filename, unsigned width, unsigned height, std::string_view guess_encoding) |
| GlyphList | Read_Font (std::filesystem::path filename, unsigned width, unsigned height, bool find, std::string_view guess_encoding) |
Contains low-level functions for parsing font files. Used by ReadFontsList and FontPlan.
| struct PSFheader |
Data that is read from the PSF file header.
| std::vector<char32_t> BDFtranslateToUnicode | ( | int | index, |
| std::string_view | reg, | ||
| std::string_view | enc | ||
| ) |
Attempts to convert a character index into unicode using the given encoding.
| index | Character index to convert |
| reg | First part of encoding name (registry) |
| enc | Second part of encoding name (encoding) |
If both reg and enc are supplied, they are joined with a dash. The following encodings are supported by built-in code: iso10646-1 and iso-8859-1: Index is returned verbatim jisx0201.1976-0: Conversion is done using built-in code
For any other encoding, a conversion table file is searched in share/encodings/. If the file is found, and the table contains information about this index, that table is used for the translation.
Additionally, indexes 00-1F and 7F are converted as in CP437; indexes 81-9F follow the CP/M plus character set with a shift. The result is an array that contains multiple choices for the encoding.
| GlyphList Read_ASM | ( | std::string_view | filename, |
| unsigned | width, | ||
| unsigned | height, | ||
| std::string_view | guess_encoding | ||
| ) |
Reads an .asm format font file.
| GlyphList Read_BDF | ( | std::string_view | filename, |
| unsigned | width, | ||
| unsigned | height, | ||
| std::string_view | guess_encoding | ||
| ) |
Reads a BDF format font file.
| GlyphList Read_Font | ( | std::filesystem::path | filename, |
| unsigned | width, | ||
| unsigned | height, | ||
| bool | find = false, |
||
| std::string_view | guess_encoding = "" |
||
| ) |
Locates a font file by the given name (
| filename | File to read |
| width | Width of glyphs in the font |
| height | Height of glyphs in the font |
| find | If true, uses FindShareFile to locate the file. If false, just reads the given path. |
| guess_encoding | Guessed encoding for the font. |
| GlyphList Read_Inc | ( | std::string_view | filename, |
| unsigned | width, | ||
| unsigned | height, | ||
| std::string_view | guess_encoding | ||
| ) |
Reads an .inc format font file.
| GlyphList Read_PSFgz | ( | std::string_view | filename, |
| unsigned | width, | ||
| unsigned | height, | ||
| std::string_view | guess_encoding | ||
| ) |
Reads a PDF.gz format font file.
| std::multimap<std::size_t, char32_t> Read_PSFgzEncoding | ( | std::string_view | filename | ) |
Reads a character encoding table from a PSF.GZ file.
| std::string ReadGZ | ( | std::string_view | filename | ) |
Reads a GZIP-compressed or deflated file and decompresses it using TinyDeflate.