1 99:59:59,999 --> 99:59:59,999 Okay, good morning everyone. 2 99:59:59,999 --> 99:59:59,999 I'm going to talk about the Linux Font Rendering stack, 3 99:59:59,999 --> 99:59:59,999 and that is what I learned the last four and a half years. 4 99:59:59,999 --> 99:59:59,999 I worked at the city administration of Munich. 5 99:59:59,999 --> 99:59:59,999 For introduction to font rendering, 6 99:59:59,999 --> 99:59:59,999 I can say writing is the most used interface, 7 99:59:59,999 --> 99:59:59,999 or probably the most used interface between humans and the machines. 8 99:59:59,999 --> 99:59:59,999 So all of you probably use it everyday on your computer. 9 99:59:59,999 --> 99:59:59,999 Screen text is replacing text on paper more and more 10 99:59:59,999 --> 99:59:59,999 and this is still an ongoing process. 11 99:59:59,999 --> 99:59:59,999 The way from a string in a computer to display text is surprisingly complex, 12 99:59:59,999 --> 99:59:59,999 And writing in itself is quite profound. 13 99:59:59,999 --> 99:59:59,999 For example, it's influenced by history so probably all, or at least most, 14 99:59:59,999 --> 99:59:59,999 writing systems are derived from some pictograph writing systems. 15 99:59:59,999 --> 99:59:59,999 This is also true for Roman letters. 16 99:59:59,999 --> 99:59:59,999 And also the Roman letters themselves, they changed a lot since 2000 years ago. 17 99:59:59,999 --> 99:59:59,999 In the Roman Empire they used some different letters than we use now. 18 99:59:59,999 --> 99:59:59,999 So the goal of this talk is to raise awareness of font rendering in computing, 19 99:59:59,999 --> 99:59:59,999 with the focus on the Linux desktop. 20 99:59:59,999 --> 99:59:59,999 Now to the history, and then I talk about typography. 21 99:59:59,999 --> 99:59:59,999 Text display in early computing. 22 99:59:59,999 --> 99:59:59,999 In early computing it was just a way to display results. 23 99:59:59,999 --> 99:59:59,999 Before that there were only flashing lights 24 99:59:59,999 --> 99:59:59,999 where you can read the results and... 25 99:59:59,999 --> 99:59:59,999 [audience member] ??... BT100 ?? raise your hand 26 99:59:59,999 --> 99:59:59,999 [Max] And the output device receives a page or a character stream, 27 99:59:59,999 --> 99:59:59,999 and then the presentation is the job of the output device. 28 99:59:59,999 --> 99:59:59,999 So for example, a typewriter or a printer or a terminal. 29 99:59:59,999 --> 99:59:59,999 And this is a BT100 you can see on the right side. 30 99:59:59,999 --> 99:59:59,999 So this is a real terminal. 31 99:59:59,999 --> 99:59:59,999 But going on in history there's the home computer era. 32 99:59:59,999 --> 99:59:59,999 In the home computer era you have fixed character sets 33 99:59:59,999 --> 99:59:59,999 and most of the time due to system limiatations, memory limitations, 34 99:59:59,999 --> 99:59:59,999 you have graphics mode and text mode. 35 99:59:59,999 --> 99:59:59,999 In the graphics mode you can basically set the pixels more or less as you want, 36 99:59:59,999 --> 99:59:59,999 and in the text mode you can use fonts. 37 99:59:59,999 --> 99:59:59,999 The screen configuration at that time is more or less defined 38 99:59:59,999 --> 99:59:59,999 by the state of technology. 39 99:59:59,999 --> 99:59:59,999 So every screen at that time has more or less the same resolution, 40 99:59:59,999 --> 99:59:59,999 and that's something that the engineers of that time relied on, 41 99:59:59,999 --> 99:59:59,999 and also software engineers relied on. 42 99:59:59,999 --> 99:59:59,999 The text rendering was just using bitmap fonts. 43 99:59:59,999 --> 99:59:59,999 That means you have a fixed size character and you just define it pixelwise 44 99:59:59,999 --> 99:59:59,999 so it's some kind of hand-crafted characters. 45 99:59:59,999 --> 99:59:59,999 You have a given raster and then you really display 46 99:59:59,999 --> 99:59:59,999 these hard-defined characters. 47 99:59:59,999 --> 99:59:59,999 So then I need to introduce a few typography terms. 48 99:59:59,999 --> 99:59:59,999 First, there's glyph or a character. 49 99:59:59,999 --> 99:59:59,999 That's...well you can say a symbol. 50 99:59:59,999 --> 99:59:59,999 So I think most people can understand what that means. 51 99:59:59,999 --> 99:59:59,999 Then a font, this is a set of glyphs. 52 99:59:59,999 --> 99:59:59,999 And then we have a collection of fonts, that is called typeface or font family. 53 99:59:59,999 --> 99:59:59,999 Those are closely related fonts with the same visual appearance, 54 99:59:59,999 --> 99:59:59,999 And they differ only in slopes or widths or weights for example. 55 99:59:59,999 --> 99:59:59,999 Usually with typesetting, with moving letters in the printing press, 56 99:59:59,999 --> 99:59:59,999 you really had, for weight for example, different pieces/letters/hardware. 57 99:59:59,999 --> 99:59:59,999 And then the point size, or typographic unit. 58 99:59:59,999 --> 99:59:59,999 This is a measure of the size, and derives directly from the printing press 59 99:59:59,999 --> 99:59:59,999 with moving letters. 60 99:59:59,999 --> 99:59:59,999 There are different definitions, and what we probably all use as point size is the 61 99:59:59,999 --> 99:59:59,999 DTP point – desktop publishing point, 62 99:59:59,999 --> 99:59:59,999 where one point is defined as 1/72 inch, which is 0.3527 period millimeters. 63 99:59:59,999 --> 99:59:59,999 It is interesting to note that this has nothing to do with pixels. 64 99:59:59,999 --> 99:59:59,999 [Audience Member] (unintelligible question) 65 99:59:59,999 --> 99:59:59,999 [Max] Please use the microphone if you a question. 66 99:59:59,999 --> 99:59:59,999 [Audience Member] ...3257, what's the bar over the 7 mean? 67 99:59:59,999 --> 99:59:59,999 [Max] It means that the 7 goes on and on and on forever. 68 99:59:59,999 --> 99:59:59,999 So this is typography of the Latin alphabet...terminology. 69 99:59:59,999 --> 99:59:59,999 There's something called kerning. 70 99:59:59,999 --> 99:59:59,999 You can see an example of kerning on the right side. 71 99:59:59,999 --> 99:59:59,999 So in the printing press you have letters and they usually have a gap. 72 99:59:59,999 --> 99:59:59,999 To improve the readability, and to make all the text appear more uniform 73 99:59:59,999 --> 99:59:59,999 the typesetter reduces the gap. 74 99:59:59,999 --> 99:59:59,999 With moving letters they have special letter pairs... 75 99:59:59,999 --> 99:59:59,999 if you go on with this there are ligatures, 76 99:59:59,999 --> 99:59:59,999 which are replacement glyphs for close standing characters. 77 99:59:59,999 --> 99:59:59,999 An example of this is a double f, fi or fl. 78 99:59:59,999 --> 99:59:59,999 So you can see also in the slides here that double f is such a ligature. 79 99:59:59,999 --> 99:59:59,999 It's one connected glyph. 80 99:59:59,999 --> 99:59:59,999 And then there's a speciality if you reverse all of the ?? [static]. 81 99:59:59,999 --> 99:59:59,999 The term non-proportional font. 82 99:59:59,999 --> 99:59:59,999 So you have a font where very character, every glyph, has the same width. 83 99:59:59,999 --> 99:59:59,999 This is also called monospace font. 84 99:59:59,999 --> 99:59:59,999 Sometimes you distinguish half-width and full width letters. 85 99:59:59,999 --> 99:59:59,999 This is also something you would see on a typewriter for example. 86 99:59:59,999 --> 99:59:59,999 Early bitmap fonts are usually monospaced fonts. 87 99:59:59,999 --> 99:59:59,999 Okay, let's go to the text rendering stack. 88 99:59:59,999 --> 99:59:59,999 Text rendering today. 89 99:59:59,999 --> 99:59:59,999 In all computing nowadays, typography is introduced. 90 99:59:59,999 --> 99:59:59,999 So won't find many devices on the market which don't use accurate typography. 91 99:59:59,999 --> 99:59:59,999 Glyphs are now represented as size-independent outlines. 92 99:59:59,999 --> 99:59:59,999 We can see on the right side there's a font editor: Font Forge. 93 99:59:59,999 --> 99:59:59,999 This is the way that such fonts are created. 94 99:59:59,999 --> 99:59:59,999 So you can see here in the picture the outline of the "S". 95 99:59:59,999 --> 99:59:59,999 It's a size-independent outline and you can just use that for 96 99:59:59,999 --> 99:59:59,999 every kind of display. 97 99:59:59,999 --> 99:59:59,999 And then you do something that is called rasterization, or sampling, or rendering 98 99:59:59,999 --> 99:59:59,999 for displaying it at the actual display. 99 99:59:59,999 --> 99:59:59,999 In the past this allowed for new applications for computers. 100 99:59:59,999 --> 99:59:59,999 First it allowed word processing and computer-based typesetting. 101 99:59:59,999 --> 99:59:59,999 Before that typesetting was a very hard job. 102 99:59:59,999 --> 99:59:59,999 It allowed internationalization. 103 99:59:59,999 --> 99:59:59,999 It allows universal graphical interface which goes 104 99:59:59,999 --> 99:59:59,999 hand-in-hand with internationalization. 105 99:59:59,999 --> 99:59:59,999 Come to think of it, not so long ago it was not so common that you could 106 99:59:59,999 --> 99:59:59,999 buy devices where you can easily switch the language to 107 99:59:59,999 --> 99:59:59,999 any language you would like. 108 99:59:59,999 --> 99:59:59,999 This is just a recent development. 109 99:59:59,999 --> 99:59:59,999 So now I will give you an overview of the formats we see on Linux systems. 110 99:59:59,999 --> 99:59:59,999 First I talk about the bitmap formats. 111 99:59:59,999 --> 99:59:59,999 Today we have bitmap formats in the PC Screen Font format, 112 99:59:59,999 --> 99:59:59,999 PSF or PSFU. 113 99:59:59,999 --> 99:59:59,999 These are the fonts that are used for the Linux VT, also known as the console. 114 99:59:59,999 --> 99:59:59,999 Usually you can store in such a font 256 or 512 glyphs. 115 99:59:59,999 --> 99:59:59,999 Some of them contain a Unicode translation table. 116 99:59:59,999 --> 99:59:59,999 And on the other hand there are X Window System Bitmap Fonts. 117 99:59:59,999 --> 99:59:59,999 There are three formats: 118 99:59:59,999 --> 99:59:59,999 There's a Sever normal Format (SNF). 119 99:59:59,999 --> 99:59:59,999 Glyph Bitmap Distribution Format (BDF). 120 99:59:59,999 --> 99:59:59,999 And Portable Compiled Format (PCF). 121 99:59:59,999 --> 99:59:59,999 Nowadays PCF is the only letter that you can find on a Linux system if so, 122 99:59:59,999 --> 99:59:59,999 and the first two are deprecated. 123 99:59:59,999 --> 99:59:59,999 And also the X Window Bitmap Fonts themselves are not very common these days. 124 99:59:59,999 --> 99:59:59,999 To the outline font formats. 125 99:59:59,999 --> 99:59:59,999 There are Postscript Formats. 126 99:59:59,999 --> 99:59:59,999 Postscript Formats have different versions as I would call them. It's called types. 127 99:59:59,999 --> 99:59:59,999 Type 1 is the one that is still relevant, to a certain degree. 128 99:59:59,999 --> 99:59:59,999 Those are the ones you can probably 129 99:59:59,999 --> 99:59:59,999 find on a standard Debian installation for example. 130 99:59:59,999 --> 99:59:59,999 It uses cubic bezier curves. 131 99:59:59,999 --> 99:59:59,999 The file format is divided into different files. 132 99:59:59,999 --> 99:59:59,999 So for every font you have Printer Font ASCII 133 99:59:59,999 --> 99:59:59,999 or a Printer Font Binary file, and you have 134 99:59:59,999 --> 99:59:59,999 a Print Font Metric or Adobe Font Metric file. 135 99:59:59,999 --> 99:59:59,999 Then you have the Truetype file format. 136 99:59:59,999 --> 99:59:59,999 This is more common. I guess everyone heard of that already. 137 99:59:59,999 --> 99:59:59,999 It uses quadratic bezier curves. 138 99:59:59,999 --> 99:59:59,999 It can contain optional code for TrueType Hinting Virtual Machine. 139 99:59:59,999 --> 99:59:59,999 What that means I will explain latter. 140 99:59:59,999 --> 99:59:59,999 There's a third format, the OpenType format, 141 99:59:59,999 --> 99:59:59,999 which has two possible glyph formats: one is truetype, 142 99:59:59,999 --> 99:59:59,999 and the other is Compact Font Format, which is based on Postscript Type 2. 143 99:59:59,999 --> 99:59:59,999 So you can say what is new in this format, or what's the difference? 144 99:59:59,999 --> 99:59:59,999 Well it supports so-called Smartfonts. 145 99:59:59,999 --> 99:59:59,999 That means you can have language-specific ligatures or character substitutions. 146 99:59:59,999 --> 99:59:59,999 For example, kerning classes, which means you have a class of characters like 147 99:59:59,999 --> 99:59:59,999 the A and different variations. 148 99:59:59,999 --> 99:59:59,999 So these are A with different diacritic symbols, 149 99:59:59,999 --> 99:59:59,999 and you can just use one kerning class for all of those characters and don't have to 150 99:59:59,999 --> 99:59:59,999 invent the wheel for every A with diacritic symbols anew. 151 99:59:59,999 --> 99:59:59,999 Now to the font rendering techniques that I use today. 152 99:59:59,999 --> 99:59:59,999 This only applies to the outline fonts because well rendering bitmap fonts is 153 99:59:59,999 --> 99:59:59,999 obviously quite easy. You just paint the pixels that are in the bitmap. 154 99:59:59,999 --> 99:59:59,999 So rasterization is all about using outline fonts. 155 99:59:59,999 --> 99:59:59,999 The one library library that is used all over the free and open source world 156 99:59:59,999 --> 99:59:59,999 is FreeType. 157 99:59:59,999 --> 99:59:59,999 It is used on Linux system, BSD desktops, Android, and ReactOS, and also some others. 158 99:59:59,999 --> 99:59:59,999 For example it is contained in Ghostscript and therefore in most of the printers. 159 99:59:59,999 --> 99:59:59,999 It's also on iOS [exhale]. 160 99:59:59,999 --> 99:59:59,999 So the naive rasterization algorithm would be just lay a pixel raster over the outline, 161 99:59:59,999 --> 99:59:59,999 over the character you want to display, and if the center of the pixel is inside 162 99:59:59,999 --> 99:59:59,999 the outline then you set the color to black. 163 99:59:59,999 --> 99:59:59,999 The problem is the so called aliasing effect. 164 99:59:59,999 --> 99:59:59,999 This is what you can see in the picture below. 165 99:59:59,999 --> 99:59:59,999 So those are the same words, rendered at different resolutions. 166 99:59:59,999 --> 99:59:59,999 The left one has 10x the resolution of the right one. 167 99:59:59,999 --> 99:59:59,999 You can see that, for example, the 'w' is quite deformed. 168 99:59:59,999 --> 99:59:59,999 Or the curl of the 'g'; there's even a part missing. 169 99:59:59,999 --> 99:59:59,999 So you have details of the font which are lost, 170 99:59:59,999 --> 99:59:59,999 and you have artefacts. 171 99:59:59,999 --> 99:59:59,999 Somehow, especially in the early computing days you wanted to reduce those, 172 99:59:59,999 --> 99:59:59,999 and therefore you used a technique called hinting. 173 99:59:59,999 --> 99:59:59,999 This is to avoid such artefacts and improve the readability 174 99:59:59,999 --> 99:59:59,999 at lower resolutions. 175 99:59:59,999 --> 99:59:59,999 Therefore the outline adjusted to fit the pixel raster at the rasterization. 176 99:59:59,999 --> 99:59:59,999 Some of the fonts can contain instructions, the so-called hints 177 99:59:59,999 --> 99:59:59,999 where the the name comes from. 178 99:59:59,999 --> 99:59:59,999 You can see in the example here, in the picture above, 179 99:59:59,999 --> 99:59:59,999 that it's quite a good result. 180 99:59:59,999 --> 99:59:59,999 This is much more readable than the word above. 181 99:59:59,999 --> 99:59:59,999 However, with the use of hinting, there are also characteristics of the font lost 182 99:59:59,999 --> 99:59:59,999 which is obvious because if you change the outline 183 99:59:59,999 --> 99:59:59,999 then obviously characteristics get lost. 184 99:59:59,999 --> 99:59:59,999 And especially important for word processing, 185 99:59:59,999 --> 99:59:59,999 what you see is what you get word processing, 186 99:59:59,999 --> 99:59:59,999 that the tracking of the font is changed. 187 99:59:59,999 --> 99:59:59,999 So tracking means the width of single characters. 188 99:59:59,999 --> 99:59:59,999 The picture below, this is a picture I took from LibreOffice. 189 99:59:59,999 --> 99:59:59,999 If you have a close look, you can see that the gap between those 'i' characters 190 99:59:59,999 --> 99:59:59,999 is not always the same. 191 99:59:59,999 --> 99:59:59,999 But if do word processing, you actually want to have a result which looks the same 192 99:59:59,999 --> 99:59:59,999 as on the printout. 193 99:59:59,999 --> 99:59:59,999 So I would recommend no to hint fonts in 194 99:59:59,999 --> 99:59:59,999 a what you see is what you get word processor. 195 99:59:59,999 --> 99:59:59,999 If you have a look beyond the backyard, on macOS, there exists no hinting, 196 99:59:59,999 --> 99:59:59,999 and in the Windows world, hint can't be turned off, 197 99:59:59,999 --> 99:59:59,999 so this is hardwired in the font rendering of the Windows system. 198 99:59:59,999 --> 99:59:59,999 Well anther approach to improve readability is anti-aliasing 199 99:59:59,999 --> 99:59:59,999 which applies multisampling. 200 99:59:59,999 --> 99:59:59,999 So for every pixel you take samples at different spots 201 99:59:59,999 --> 99:59:59,999 and then you compute from that a gray value, 202 99:59:59,999 --> 99:59:59,999 which is a measure of how much of the area of the pixel is covered by the glyph. 203 99:59:59,999 --> 99:59:59,999 On the picture you can see again the simple raster word, 204 99:59:59,999 --> 99:59:59,999 and then in the middle you see the word with anti-alising, 205 99:59:59,999 --> 99:59:59,999 and below you can see a combination of hinting and antialiasing. 206 99:59:59,999 --> 99:59:59,999 Suddenly the text becomes very readable also on low resolutions. 207 99:59:59,999 --> 99:59:59,999 This is what is usually used in computing in the 90s. 208 99:59:59,999 --> 99:59:59,999 So there is another approach to improve and therefore I have to 209 99:59:59,999 --> 99:59:59,999 talk a bit about LCD displays. 210 99:59:59,999 --> 99:59:59,999 So in the picture on the left, above you can see tube monitor pixels and 211 99:59:59,999 --> 99:59:59,999 on the bottom you can see LCD monitor pixels. 212 99:59:59,999 --> 99:59:59,999 All of the pixels consist of so-called subpixels with different colors. 213 99:59:59,999 --> 99:59:59,999 The mixture of the three different colors 214 99:59:59,999 --> 99:59:59,999 gives them a wide range of different colors. 215 99:59:59,999 --> 99:59:59,999 With the tube monitors this is not used, but with LCD display 216 99:59:59,999 --> 99:59:59,999 depending on the configuration of the subpixels 217 99:59:59,999 --> 99:59:59,999 it can be used to improve improve the resolution in one direction. 218 99:59:59,999 --> 99:59:59,999 Therefore you have to know how the configuration of the display is. 219 99:59:59,999 --> 99:59:59,999 So usually, one pixel, which you can see in the picture below right? 220 99:59:59,999 --> 99:59:59,999 These are the usual computer monitors. 221 99:59:59,999 --> 99:59:59,999 One pixel consists of a red, green and a blue subpixel in this order. 222 99:59:59,999 --> 99:59:59,999 But you have to keep in mind, especially with tablets, or smartphones, 223 99:59:59,999 --> 99:59:59,999 you can rotate the screen, so you have to keep that in mind. 224 99:59:59,999 --> 99:59:59,999 Also there are other subpixel configurations. 225 99:59:59,999 --> 99:59:59,999 For example, depending on the technology there can be additional red or green 226 99:59:59,999 --> 99:59:59,999 or even white subpixels. 227 99:59:59,999 --> 99:59:59,999 So there are also multiple possibilities of the configuration. 228 99:59:59,999 --> 99:59:59,999 We can use this configuration as I said to improve the resolution 229 99:59:59,999 --> 99:59:59,999 and in the usual case this is horizontally. 230 99:59:59,999 --> 99:59:59,999 You can see on the picture on the left side, 231 99:59:59,999 --> 99:59:59,999 first there's the naive, simple rendered character, 232 99:59:59,999 --> 99:59:59,999 then the character just using anti-aliasing, 233 99:59:59,999 --> 99:59:59,999 and then there's the subpixel rendered character. 234 99:59:59,999 --> 99:59:59,999 This one is the most readable or most sharp character. 235 99:59:59,999 --> 99:59:59,999 Not sharp!... but it's most correctly rendered according to the outline font. 236 99:59:59,999 --> 99:59:59,999 Depending on the technique of the display, 237 99:59:59,999 --> 99:59:59,999 you can see a color haze around the characters. 238 99:59:59,999 --> 99:59:59,999 So this happens when the software and the display technology 239 99:59:59,999 --> 99:59:59,999 don't match each other. 240 99:59:59,999 --> 99:59:59,999 So this is what you can see on the picture on the right. 241 99:59:59,999 --> 99:59:59,999 Okay, let's talk about the font rendering software parts in the Linux desktop. 242 99:59:59,999 --> 99:59:59,999 There's the so-called server-side text rendering. 243 99:59:59,999 --> 99:59:59,999 So in the X server there's the Core Font subsystem. 244 99:59:59,999 --> 99:59:59,999 With that, X11 clients can request the server to display a text 245 99:59:59,999 --> 99:59:59,999 by sending a string via libXfont 246 99:59:59,999 --> 99:59:59,999 and using the so-called X Logical Font Description (XLFD). 247 99:59:59,999 --> 99:59:59,999 Here's an example for Adobe Career font, 248 99:59:59,999 --> 99:59:59,999 then the X server has to then render the text using the font. 249 99:59:59,999 --> 99:59:59,999 If you imagine a terminal server setup with thin clients, 250 99:59:59,999 --> 99:59:59,999 then the thin client runs the X server and the terminal server runs the X client 251 99:59:59,999 --> 99:59:59,999 and every thin client then has to handle the font rendering. 252 99:59:59,999 --> 99:59:59,999 So I don't know if this is the only reason, 253 99:59:59,999 --> 99:59:59,999 but nowadays server-side font rendering is not so common. 254 99:59:59,999 --> 99:59:59,999 Probably not used anymore. 255 99:59:59,999 --> 99:59:59,999 Now I have to talk first about font management. 256 99:59:59,999 --> 99:59:59,999 In Linux systems there is a software called fontconfig, 257 99:59:59,999 --> 99:59:59,999 which manages installed fonts on the system 258 99:59:59,999 --> 99:59:59,999 and it configures for example how to substitute fonts. 259 99:59:59,999 --> 99:59:59,999 For example if in a document there's a font to render a text 260 99:59:59,999 --> 99:59:59,999 and the font is not available on the system 261 99:59:59,999 --> 99:59:59,999 then in the font config system there can be rules to replace the font 262 99:59:59,999 --> 99:59:59,999 with a similar font. 263 99:59:59,999 --> 99:59:59,999 This is heavily used in Linux systems. 264 99:59:59,999 --> 99:59:59,999 There are also rules for what font to use if the current selected font 265 99:59:59,999 --> 99:59:59,999 doesn't contain a character you want to display. 266 99:59:59,999 --> 99:59:59,999 You can see on the picture on the right that this is also used... 267 99:59:59,999 --> 99:59:59,999 although I have to admit, 268 99:59:59,999 --> 99:59:59,999 I had to take this picture on a Debian 5.0 system in LibreOffice 269 99:59:59,999 --> 99:59:59,999 because nowadays it works a bit different, 270 99:59:59,999 --> 99:59:59,999 but this is a good example where you can see that those characters 271 99:59:59,999 --> 99:59:59,999 come from different fonts actually. 272 99:59:59,999 --> 99:59:59,999 There's also a command line tool which is quite nice. 273 99:59:59,999 --> 99:59:59,999 fc-match command line tool. 274 99:59:59,999 --> 99:59:59,999 So for example if you want to see what is the replacement font for, let's say, Arial 275 99:59:59,999 --> 99:59:59,999 then you get the output: okay, it's Nimbus Sans. 276 99:59:59,999 --> 99:59:59,999 And you can also set rendering options, 277 99:59:59,999 --> 99:59:59,999 which means you can set anti-aliasing or you can turn off hinting. 278 99:59:59,999 --> 99:59:59,999 Usually these configurations are stored in /etc/fonts 279 99:59:59,999 --> 99:59:59,999 and there is also a per-user configuration in .config/fontconfig 280 99:59:59,999 --> 99:59:59,999 and it's in XML file format snippets. 281 99:59:59,999 --> 99:59:59,999 In the picture you can see an example. 282 99:59:59,999 --> 99:59:59,999 This is the replacement rule for Carlito and Calibri. 283 99:59:59,999 --> 99:59:59,999 Carlito is a replacement font for the nowadays often used 284 99:59:59,999 --> 99:59:59,999 Calibri font from Microsoft. 285 99:59:59,999 --> 99:59:59,999 So this configuration says the one way, Carlito is the same as Calibri, 286 99:59:59,999 --> 99:59:59,999 and the other way around. 287 99:59:59,999 --> 99:59:59,999 This is just an example, 288 99:59:59,999 --> 99:59:59,999 you can have a look at /etc/fonts and a lot of such snippets. 289 99:59:59,999 --> 99:59:59,999 It defines how fonts are displayed on the system. 290 99:59:59,999 --> 99:59:59,999 Another thing, and this is the reason why I had to take the screenshot 291 99:59:59,999 --> 99:59:59,999 on an older system, there's a piece of software called HarfBuzz. 292 99:59:59,999 --> 99:59:59,999 HarfBuzz is Persian for OpenType, 293 99:59:59,999 --> 99:59:59,999 so this software relies on the OpenType font format. 294 99:59:59,999 --> 99:59:59,999 You can see on the right side the HarfBuzz logo 295 99:59:59,999 --> 99:59:59,999 that actually says HarfBuzz in Persian. 296 99:59:59,999 --> 99:59:59,999 Before I talked about ligatures, 297 99:59:59,999 --> 99:59:59,999 In some languages ligatures are required to render fonts correctly 298 99:59:59,999 --> 99:59:59,999 and this is an example on the left of Devanagari, which is an Indic script. 299 99:59:59,999 --> 99:59:59,999 So if you have the first two characters combined then this is the rule 300 99:59:59,999 --> 99:59:59,999 of how to replace those characters with a third glyph. 301 99:59:59,999 --> 99:59:59,999 There were early implementations by Qt for Pangul 302 99:59:59,999 --> 99:59:59,999 and those were integrated in HarfBuzz. 303 99:59:59,999 --> 99:59:59,999 Well those parts are now known as Harfbuzz Old, 304 99:59:59,999 --> 99:59:59,999 and the current HarfBuzz is a rewrite. 305 99:59:59,999 --> 99:59:59,999 Nowaday's it's also used for the so-called simple script, 306 99:59:59,999 --> 99:59:59,999 meaning especially Latin script, 307 99:59:59,999 --> 99:59:59,999 and is integrated into Qt, GTK, LibreOffice, Firefox, Android, and XETEX. 308 99:59:59,999 --> 99:59:59,999 This is what I use for the slides here, 309 99:59:59,999 --> 99:59:59,999 so all the slides here are also rendered using HarfBuzz. 310 99:59:59,999 --> 99:59:59,999 And of course the whole font rendering stack. 311 99:59:59,999 --> 99:59:59,999 HarfBuzz also has fancy features like variable widths or weight 312 99:59:59,999 --> 99:59:59,999 with only one font or you can define in the font characters with 313 99:59:59,999 --> 99:59:59,999 variable widths and without stepping you can change it using HarfBuzz. 314 99:59:59,999 --> 99:59:59,999 Those techniques are used in client-side rendering. 315 99:59:59,999 --> 99:59:59,999 One library often was until recently often used, Xft.