0:00:06.280,0:00:09.300 Okay, good morning everyone. 0:00:09.300,0:00:12.540 I'm going to talk about the[br]Linux Font Rendering stack, 0:00:12.860,0:00:18.680 and that is what I learned the last[br]four and a half years. 0:00:18.680,0:00:22.080 I worked at the[br]city administration of Munich. 0:00:22.920,0:00:28.400 For introduction to font rendering, 0:00:30.320,0:00:34.780 I can say writing is[br]the most used interface, 0:00:34.780,0:00:39.080 or probably the most used interface[br]between humans and the machines. 0:00:39.080,0:00:45.700 So all of you probably use it everyday[br]on your computer. 0:00:48.500,0:00:52.780 Screen text is replacing text on paper[br]more and more 0:00:52.780,0:00:56.820 and this is still an ongoing process. 0:01:00.620,0:01:09.160 The way from a string in a computer to[br]display text is surprisingly complex, 0:01:09.160,0:01:14.640 And writing in itself is quite profound. 0:01:14.640,0:01:24.960 For example, it's influenced by history[br]so probably all, or at least most, 0:01:24.960,0:01:30.680 writing systems are derived from some[br]pictograph writing systems. 0:01:31.140,0:01:34.440 This is also true for Roman letters. 0:01:36.080,0:01:43.980 And also the Roman letters themselves,[br]they changed a lot since 2000 years ago. 0:01:43.980,0:01:51.120 In the Roman Empire they used some[br]different letters than we use now. 0:01:51.120,0:01:56.980 So the goal of this talk is to raise[br]awareness of font rendering in computing, 0:01:56.980,0:02:00.740 with the focus on the Linux desktop. 0:02:04.740,0:02:11.680 Now to the history,[br]and then I talk about typography. 0:02:13.780,0:02:17.280 Text display in early computing. 0:02:17.380,0:02:24.760 In early computing it was just[br]a way to display results. 0:02:26.380,0:02:29.900 Before that there were[br]only flashing lights 0:02:29.900,0:02:34.420 where you can read the results[br]and... 0:02:35.660,0:02:39.840 [audience member] ??... BT100[br]?? raise your hand 0:02:43.300,0:02:47.660 [Max] And the output device receives[br]a page or a character stream, 0:02:47.660,0:02:52.000 and then the presentation is the job[br]of the output device. 0:02:52.000,0:02:58.000 So for example, a typewriter[br]or a printer or a terminal. 0:02:58.000,0:03:05.780 And this is a BT100[br]you can see on the right side. 0:03:05.780,0:03:08.340 So this is a real terminal. 0:03:13.260,0:03:19.420 But going on in history[br]there's the home computer era. 0:03:21.860,0:03:25.460 In the home computer era you have[br]fixed character sets 0:03:25.740,0:03:31.840 and most of the time due to system[br]limitations, memory limitations, 0:03:31.840,0:03:35.700 you have graphics mode and text mode. 0:03:38.100,0:03:46.840 In the graphics mode you can basically[br]set the pixels more or less as you want, 0:03:46.840,0:03:53.000 and in the text mode you can use fonts. 0:03:55.620,0:03:59.540 The screen configuration at that time[br]is more or less defined 0:03:59.540,0:04:01.540 by the state of technology. 0:04:01.540,0:04:07.740 So every screen at that time has more or[br]less the same resolution, 0:04:07.740,0:04:15.680 and that's something that the engineers[br]of that time relied on, 0:04:15.680,0:04:18.200 and also software engineers relied on. 0:04:19.660,0:04:24.980 The text rendering was just[br]using bitmap fonts. 0:04:24.980,0:04:37.120 That means you have a fixed size character[br]and you just define it pixelwise 0:04:38.780,0:04:45.040 so it's some kind of hand-crafted[br]characters. 0:04:45.040,0:04:51.320 You have a given raster and then[br]you really display 0:04:51.320,0:04:54.340 these hard-defined characters. 0:04:59.520,0:05:06.740 So then I need to introduce a few[br]typography terms. 0:05:12.380,0:05:16.260 First, there's glyph or a character. 0:05:21.320,0:05:25.420 That's...well you can say a symbol. 0:05:26.920,0:05:31.700 So I think most people can understand what[br]that means. 0:05:31.700,0:05:36.240 Then a font, this is a set of glyphs. 0:05:38.040,0:05:45.320 And then we have a collection of fonts,[br]that is called typeface or font family. 0:05:45.320,0:05:53.020 Those are closely related fonts with[br]the same visual appearance, 0:05:53.020,0:05:59.920 And they differ only in slopes or widths[br]or weights for example. 0:06:03.880,0:06:12.480 Usually with typesetting, with moving[br]letters in the printing press, 0:06:12.480,0:06:25.140 you really had, for weight for example,[br]different pieces/letters/hardware. 0:06:27.740,0:06:31.460 And then the point size,[br]or typographic unit. 0:06:32.560,0:06:41.780 This is a measure of the size, and[br]derives directly from the printing press 0:06:42.560,0:06:44.560 with moving letters. 0:06:48.400,0:06:56.500 There are different definitions, and what[br]we probably all use as point size is the 0:06:56.500,0:07:03.760 DTP point – desktop publishing point, 0:07:03.760,0:07:18.520 where one point is defined as 1/72 inch,[br]which is 0.3527 period millimeters. 0:07:18.520,0:07:25.980 It is interesting to note that this has[br]nothing to do with pixels. 0:07:28.600,0:07:30.980 [question] (unintelligible question) 0:07:30.980,0:07:34.700 [Max] Please use the microphone[br]if you a question. 0:07:35.900,0:07:39.440 [question] ...3257, what's the bar[br]over the 7 mean? 0:07:39.440,0:07:43.160 [Max] It means that the 7 goes[br]on and on and on forever. 0:07:51.000,0:07:58.500 So this is typography of the[br]Latin alphabet...terminology. 0:07:58.500,0:08:01.740 There's something called kerning. 0:08:02.400,0:08:08.380 You can see an example of kerning[br]on the right side. 0:08:08.380,0:08:19.180 So in the printing press you have letters[br]and they usually have a gap. 0:08:21.400,0:08:29.600 To improve the readability, and to[br]make all the text appear more uniform 0:08:31.140,0:08:33.760 the typesetter reduces the gap. 0:08:35.659,0:08:39.700 With moving letters they have special[br]letter pairs... 0:08:40.679,0:08:46.060 if you go on with this[br]there are ligatures, 0:08:46.140,0:08:50.620 which are replacement glyphs for close[br]standing characters. 0:08:52.140,0:08:57.300 An example of this is a double f, fi or fl. 0:08:58.300,0:09:05.440 So you can see also in the slides here[br]that double f is such a ligature. 0:09:06.320,0:09:08.600 It's one connected glyph. 0:09:10.980,0:09:16.480 And then there's a speciality[br]if you reverse all of the ?? [static]. 0:09:18.120,0:09:20.040 The term non-proportional font. 0:09:20.040,0:09:27.300 So you have a font where very character,[br]every glyph, has the same width. 0:09:27.300,0:09:30.640 This is also called monospace font. 0:09:33.640,0:09:40.820 Sometimes you distinguish half-width[br]and full width letters. 0:09:41.480,0:09:45.740 This is also something you would see[br]on a typewriter for example. 0:09:47.440,0:09:54.020 Early bitmap fonts are usually[br]monospaced fonts. 0:09:56.440,0:10:01.740 Okay, let's go to[br]the text rendering stack. 0:10:06.520,0:10:08.980 Text rendering today. 0:10:10.400,0:10:15.060 In all computing nowadays,[br]typography is introduced. 0:10:15.080,0:10:24.500 So won't find many devices on the market[br]which don't use accurate typography. 0:10:28.160,0:10:32.280 Glyphs are now represented as[br]size-independent outlines. 0:10:32.280,0:10:37.520 We can see on the right side there's[br]a font editor: Font Forge. 0:10:37.520,0:10:41.900 This is the way that such fonts[br]are created. 0:10:41.900,0:10:47.160 So you can see here in the picture[br]the outline of the "S". 0:10:49.200,0:10:55.960 It's a size-independent outline and[br]you can just use that for 0:10:55.960,0:10:59.180 every kind of display. 0:10:59.180,0:11:04.020 And then you do something that is called[br]rasterization, or sampling, or rendering 0:11:04.020,0:11:08.000 for displaying it at the actual display. 0:11:09.660,0:11:13.760 In the past this allowed for new[br]applications for computers. 0:11:13.760,0:11:19.680 First it allowed word processing and[br]computer-based typesetting. 0:11:21.240,0:11:26.320 Before that typesetting was[br]a very hard job. 0:11:26.740,0:11:30.800 It allowed internationalization. 0:11:36.600,0:11:41.500 It allows universal graphical interface[br]which goes 0:11:41.500,0:11:45.420 hand-in-hand with internationalization. 0:11:46.280,0:11:52.380 Come to think of it, not so long ago it[br]was not so common that you could 0:11:52.380,0:11:58.280 buy devices where you can easily switch[br]the language to 0:11:58.280,0:12:01.680 any language you would like. 0:12:01.680,0:12:05.320 This is just a recent development. 0:12:06.600,0:12:15.600 So now I will give you an overview of[br]the formats we see on Linux systems. 0:12:15.600,0:12:18.880 First I talk about the bitmap formats. 0:12:18.880,0:12:27.120 Today we have bitmap formats in the[br]PC Screen Font format, 0:12:27.120,0:12:28.960 PSF or PSFU. 0:12:28.960,0:12:36.180 These are the fonts that are used for the[br]Linux VT, also known as the console. 0:12:36.180,0:12:45.700 Usually you can store in such a font[br]256 or 512 glyphs. 0:12:45.700,0:12:52.540 Some of them contain[br]a Unicode translation table. 0:12:53.800,0:12:59.500 And on the other hand there are[br]X Window System Bitmap Fonts. 0:12:59.500,0:13:02.820 There are three formats: 0:13:02.820,0:13:07.060 There's a Sever normal Format (SNF). 0:13:07.060,0:13:11.340 Glyph Bitmap Distribution Format (BDF). 0:13:11.340,0:13:13.960 And Portable Compiled Format (PCF). 0:13:13.960,0:13:22.680 Nowadays PCF is the only letter that[br]you can find on a Linux system if so, 0:13:22.680,0:13:29.160 and the first two are deprecated. 0:13:29.160,0:13:40.220 And also the X Window Bitmap Fonts[br]themselves are not very common these days. 0:13:44.560,0:13:47.380 To the outline font formats. 0:13:49.020,0:13:51.960 There are Postscript Formats. 0:13:53.920,0:14:05.240 Postscript Formats have different versions[br]as I would call them. It's called types. 0:14:05.240,0:14:11.540 Type 1 is the one that is still relevant,[br]to a certain degree. 0:14:11.540,0:14:16.760 Those are the ones you can probably 0:14:16.760,0:14:21.400 find on a standard Debian installation[br]for example. 0:14:21.400,0:14:23.880 It uses cubic bezier curves. 0:14:26.120,0:14:35.760 The file format is divided into[br]different files. 0:14:35.760,0:14:39.500 So for every font you have[br]Printer Font ASCII 0:14:39.500,0:14:44.200 or a Printer Font Binary file,[br]and you have 0:14:44.200,0:14:49.120 a Print Font Metric or[br]Adobe Font Metric file. 0:14:54.740,0:15:00.900 Then you have the Truetype file format. 0:15:02.860,0:15:07.700 This is more common. I guess everyone[br]heard of that already. 0:15:08.940,0:15:12.140 It uses quadratic bezier curves. 0:15:13.760,0:15:21.420 It can contain optional code for[br]TrueType Hinting Virtual Machine. 0:15:21.420,0:15:25.120 What that means I will explain latter. 0:15:25.120,0:15:30.740 There's a third format,[br]the OpenType format, 0:15:30.740,0:15:35.160 which has two possible glyph formats:[br]one is truetype, 0:15:35.160,0:15:40.980 and the other is Compact Font Format,[br]which is based on Postscript Type 2. 0:15:40.980,0:15:47.880 So you can say what is new in this format,[br]or what's the difference? 0:15:47.880,0:15:51.700 Well it supports so-called Smartfonts. 0:15:53.580,0:15:59.600 That means you can have language-specific[br]ligatures or character substitutions. 0:16:01.360,0:16:09.560 For example, kerning classes, which means[br]you have a class of characters like 0:16:09.560,0:16:13.520 the A and different variations. 0:16:13.520,0:16:19.820 So these are A with different diacritic[br]symbols, 0:16:19.820,0:16:30.560 and you can just use one kerning class for[br]all of those characters and don't have to 0:16:30.560,0:16:37.580 invent the wheel for every A with[br]diacritic symbols anew. 0:16:43.540,0:16:50.140 Now to the font rendering techniques that[br]I use today. 0:16:53.540,0:17:02.360 This only applies to the outline fonts[br]because well rendering bitmap fonts is 0:17:02.360,0:17:11.020 obviously quite easy. You just paint the[br]pixels that are in the bitmap. 0:17:11.020,0:17:17.480 So rasterization is all about using[br]outline fonts. 0:17:19.280,0:17:24.619 The one library library that is used all[br]over the free and open source world 0:17:24.619,0:17:26.180 is FreeType. 0:17:26.180,0:17:40.600 It is used on Linux system, BSD desktops,[br]Android, and ReactOS, and also some others. 0:17:40.600,0:17:47.300 For example it is contained in Ghostscript[br]and therefore in most of the printers. 0:17:49.040,0:17:52.140 It's also on iOS [exhale]. 0:17:53.140,0:18:00.860 So the naive rasterization algorithm would[br]be just lay a pixel raster over the outline font, 0:18:00.860,0:18:07.280 over the character you want to display,[br]and if the center of the pixel is inside 0:18:07.280,0:18:09.900 the outline then you[br]set the color to black. 0:18:14.960,0:18:19.340 The problem is the so called[br]aliasing effect. 0:18:19.340,0:18:23.820 This is what you can see[br]in the picture below. 0:18:23.820,0:18:29.760 So those are the same words,[br]rendered at different resolutions. 0:18:29.760,0:18:36.440 The left one has 10x the resolution[br]of the right one. 0:18:38.620,0:18:49.540 You can see that, for example,[br]the 'w' is quite deformed. 0:18:49.540,0:18:55.340 Or the curl of the 'g';[br]there's even a part missing. 0:18:55.340,0:18:59.800 So you have details of the font[br]which are lost, 0:18:59.800,0:19:02.040 and you have artefacts. 0:19:04.240,0:19:11.580 Somehow, especially in the early computing[br]days you wanted to reduce those, 0:19:11.580,0:19:15.480 and therefore you used a technique[br]called hinting. 0:19:15.480,0:19:20.820 This is to avoid such artefacts and[br]improve the readability 0:19:20.820,0:19:22.520 at lower resolutions. 0:19:22.520,0:19:34.660 Therefore the outline adjusted to fit the[br]pixel raster at the rasterization. 0:19:36.900,0:19:41.840 Some of the fonts can contain[br]instructions, the so-called hints 0:19:41.840,0:19:46.020 where the the name comes from. 0:19:51.360,0:19:58.860 You can see in the example here,[br]in the picture above, 0:19:58.860,0:20:07.860 that it's quite a good result. 0:20:07.860,0:20:15.480 This is much more readable[br]than the word above. 0:20:15.480,0:20:22.560 However, with the use of hinting, there[br]are also characteristics of the font lost 0:20:24.200,0:20:27.540 which is obvious because[br]if you change the outline 0:20:27.540,0:20:31.160 then obviously characteristics get lost. 0:20:31.160,0:20:37.260 And especially important for[br]word processing, 0:20:37.260,0:20:39.640 what you see is what you get[br]word processing, 0:20:39.640,0:20:43.680 that the tracking of the font is changed. 0:20:45.920,0:20:49.960 So tracking means the width[br]of single characters. 0:20:49.960,0:20:56.680 The picture below, this is a picture I[br]took from LibreOffice. 0:20:56.680,0:21:05.300 If you have a close look, you can see[br]that the gap between those 'i' characters 0:21:05.300,0:21:07.300 is not always the same. 0:21:08.040,0:21:16.880 But if do word processing, you actually[br]want to have a result which looks the same 0:21:16.880,0:21:18.880 as on the printout. 0:21:20.480,0:21:26.840 So I would recommend not[br]to hint fonts in 0:21:26.840,0:21:29.860 a what you see is what you get[br]word processor. 0:21:33.520,0:21:40.980 If you have a look beyond the backyard,[br]on macOS, there exists no hinting, 0:21:40.980,0:21:45.780 and in the Windows world, hint can't[br]be turned off, 0:21:45.780,0:21:52.320 so this is hardwired in the[br]font rendering of the Windows system. 0:21:56.120,0:22:03.480 Well another approach to improve[br]readability is anti-aliasing 0:22:03.480,0:22:08.400 which applies multisampling. 0:22:08.400,0:22:15.920 So for every pixel you take samples at[br]different spots 0:22:15.920,0:22:22.240 and then you compute from[br]that a gray value, 0:22:22.240,0:22:29.240 which is a measure of how much of the[br]area of the pixel is covered by the glyph. 0:22:33.260,0:22:40.040 On the picture you can see again[br]the simple raster word, 0:22:40.040,0:22:45.840 and then in the middle you see the word[br]with anti-aliasing, 0:22:46.240,0:22:56.000 and below you can see a combination of[br]hinting and antialiasing. 0:22:58.700,0:23:02.860 Suddenly the text becomes very readable[br]also on low resolutions. 0:23:04.740,0:23:12.460 This is what is usually used in[br]computing in the 90s. 0:23:18.440,0:23:23.560 So there is another approach to improve[br]and therefore I have to 0:23:23.560,0:23:27.080 talk a bit about LCD displays. 0:23:27.080,0:23:37.140 So in the picture on the left, above you[br]can see tube monitor pixels and 0:23:37.140,0:23:40.680 on the bottom you can see[br]LCD monitor pixels. 0:23:40.680,0:23:50.400 All of the pixels consist of so-called[br]subpixels with different colors. 0:23:52.160,0:23:55.940 The mixture of the three different colors 0:23:55.940,0:24:01.660 gives them a wide range[br]of different colors. 0:24:04.560,0:24:12.540 With the tube monitors this is not used,[br]but with LCD display 0:24:12.540,0:24:18.680 depending on the[br]configuration of the subpixels 0:24:18.680,0:24:23.320 it can be used to improve improve the[br]resolution in one direction. 0:24:23.320,0:24:29.400 Therefore you have to know how the[br]configuration of the display is. 0:24:29.400,0:24:36.980 So usually, one pixel, which you can see[br]in the picture below right? 0:24:36.980,0:24:40.120 These are the usual computer monitors. 0:24:40.120,0:24:51.860 One pixel consists of a red, green and a[br]blue subpixel in this order. 0:24:51.860,0:24:58.400 But you have to keep in mind, especially[br]with tablets, or smartphones, 0:24:58.400,0:25:05.200 you can rotate the screen, so you have to[br]keep that in mind. 0:25:06.060,0:25:11.280 Also there are other subpixel[br]configurations. 0:25:11.280,0:25:17.880 For example, depending on the technology[br]there can be additional red or green 0:25:17.880,0:25:20.180 or even white subpixels. 0:25:24.180,0:25:30.400 So there are also multiple possibilities[br]of the configuration. 0:25:33.840,0:25:39.500 We can use this configuration as I said[br]to improve the resolution 0:25:39.500,0:25:45.000 and in the usual case[br]this is horizontally. 0:25:45.000,0:25:50.440 You can see on the picture[br]on the left side, 0:25:52.800,0:25:59.400 first there's the naive,[br]simple rendered character, 0:25:59.400,0:26:03.880 then the character[br]just using anti-aliasing, 0:26:03.880,0:26:08.340 and then there's the[br]subpixel rendered character. 0:26:10.060,0:26:16.260 This one is the most readable[br]or most sharp character. 0:26:16.260,0:26:25.100 Not sharp!... but it's most correctly[br]rendered according to the outline font. 0:26:25.960,0:26:31.420 Depending on the technique of the display, 0:26:31.420,0:26:41.340 you can see a color haze[br]around the characters. 0:26:44.080,0:26:49.260 So this happens when the software[br]and the display technology 0:26:49.260,0:26:52.020 don't match each other. 0:26:54.180,0:26:59.320 So this is what you can see[br]on the picture on the right. 0:27:01.340,0:27:07.900 Okay, let's talk about the font rendering[br]software parts in the Linux desktop. 0:27:10.660,0:27:15.340 There's the so-called server-side[br]text rendering. 0:27:16.600,0:27:21.760 So in the X server there's the[br]Core Font subsystem. 0:27:25.040,0:27:31.940 With that, X11 clients can request the[br]server to display a text 0:27:31.940,0:27:36.160 by sending a string via libXfont 0:27:36.160,0:27:45.220 and using the so-called[br]X Logical Font Description (XLFD). 0:27:45.220,0:27:52.920 Here's an example for Adobe Career font, 0:27:52.920,0:28:02.600 then the X server has to then[br]render the text using the font. 0:28:05.980,0:28:10.940 If you imagine a terminal server setup[br]with thin clients, 0:28:10.940,0:28:18.500 then the thin client runs the X server[br]and the terminal server runs the X client 0:28:18.500,0:28:27.620 and every thin client then has to[br]handle the font rendering. 0:28:27.620,0:28:34.520 So I don't know if[br]this is the only reason, 0:28:34.520,0:28:40.880 but nowadays server-side font[br]rendering is not so common. 0:28:40.880,0:28:47.620 Probably not used anymore. 0:28:52.540,0:28:56.160 Now I have to talk first[br]about font management. 0:28:56.160,0:29:01.720 In Linux systems there is[br]a software called fontconfig, 0:29:01.720,0:29:05.280 which manages installed fonts[br]on the system 0:29:05.280,0:29:15.640 and it configures for example how to[br]substitute fonts. 0:29:17.160,0:29:24.280 For example if in a document there's a[br]font to render a text 0:29:24.280,0:29:27.120 and the font is not[br]available on the system 0:29:27.120,0:29:33.860 then in the font config system there can[br]be rules to replace the font 0:29:33.860,0:29:36.640 with a similar font. 0:29:37.380,0:29:41.020 This is heavily used in Linux systems. 0:29:41.020,0:29:47.760 There are also rules for what font to[br]use if the current selected font 0:29:47.760,0:29:51.480 doesn't contain a character[br]you want to display. 0:29:52.940,0:29:59.020 You can see on the picture on the right[br]that this is also used... 0:29:59.020,0:30:01.800 although I have to admit, 0:30:01.800,0:30:07.920 I had to take this picture on a Debian 5.0[br]system in LibreOffice 0:30:07.920,0:30:12.000 because nowadays[br]it works a bit different, 0:30:12.000,0:30:17.780 but this is a good example where[br]you can see that those characters 0:30:17.780,0:30:20.820 come from different fonts actually. 0:30:23.220,0:30:27.920 There's also a command line tool[br]which is quite nice. 0:30:27.920,0:30:29.580 fc-match command line tool. 0:30:29.580,0:30:37.460 So for example if you want to see what is[br]the replacement font for, let's say, Arial 0:30:37.460,0:30:40.960 then you get the output:[br]okay, it's Nimbus Sans. 0:30:44.840,0:30:47.960 And you can also set rendering options, 0:30:47.960,0:30:55.880 which means you can set anti-aliasing[br]or you can turn off hinting. 0:31:00.260,0:31:06.700 Usually these configurations are stored in[br]/etc/fonts 0:31:06.700,0:31:11.800 and there is also a per-user configuration[br]in .config/fontconfig 0:31:11.800,0:31:19.680 and it's in XML file format snippets. 0:31:21.500,0:31:24.920 In the picture you can see an example. 0:31:24.920,0:31:33.020 This is the replacement rule for[br]Carlito and Calibri. 0:31:35.540,0:31:41.540 Carlito is a replacement font for the[br]nowadays often used 0:31:41.540,0:31:44.200 Calibri font from Microsoft. 0:31:45.780,0:31:54.380 So this configuration says the one way,[br]Carlito is the same as Calibri, 0:31:54.380,0:31:56.240 and the other way around. 0:31:56.240,0:31:58.280 This is just an example, 0:31:58.280,0:32:03.940 you can have a look at /etc/fonts[br]and a lot of such snippets. 0:32:07.340,0:32:12.640 It defines how fonts are[br]displayed on the system. 0:32:16.180,0:32:23.720 Another thing, and this is the reason[br]why I had to take the screenshot 0:32:23.720,0:32:29.780 on an older system, there's a piece of[br]software called HarfBuzz. 0:32:29.780,0:32:35.240 HarfBuzz is Persian for OpenType, 0:32:35.240,0:32:41.460 so this software relies on the OpenType[br]font format. 0:32:41.460,0:32:46.400 You can see on the right side[br]the HarfBuzz logo 0:32:46.400,0:32:50.180 that actually says[br]HarfBuzz in Persian. 0:32:53.500,0:32:56.240 Before I talked about ligatures, 0:32:56.240,0:33:02.840 In some languages ligatures are required[br]to render fonts correctly 0:33:02.840,0:33:09.220 and this is an example on the left of[br]Devanagari, which is an Indic script. 0:33:11.720,0:33:17.700 So if you have the first two characters[br]combined then this is the rule 0:33:17.700,0:33:24.500 of how to replace those characters[br]with a third glyph. 0:33:29.480,0:33:34.280 There were early implementations[br]by Qt and Pango 0:33:34.280,0:33:38.740 and those were integrated in HarfBuzz. 0:33:41.140,0:33:44.780 Well those parts are now known as[br]Harfbuzz Old, 0:33:44.780,0:33:50.220 and the current HarfBuzz is a rewrite. 0:33:51.580,0:33:57.020 Nowaday's it's also used for[br]the so-called simple script, 0:33:59.260,0:34:03.660 meaning especially Latin script, 0:34:03.660,0:34:12.060 and is integrated into Qt, GTK,[br]LibreOffice, Firefox, Android, and XETEX. 0:34:12.060,0:34:14.880 This is what I use for the slides here, 0:34:14.880,0:34:20.840 so all the slides here are[br]also rendered using HarfBuzz. 0:34:20.840,0:34:24.880 And of course the whole[br]font rendering stack. 0:34:26.300,0:34:34.860 HarfBuzz also has fancy features like[br]variable widths or weight 0:34:34.860,0:34:45.760 with only one font or you can define[br]in the font characters with 0:34:45.760,0:34:55.540 variable widths and without stepping you[br]can change it using HarfBuzz. 0:34:59.940,0:35:04.760 Those techniques are used in[br]client-side rendering. 0:35:06.860,0:35:15.100 One library often was[br]until recently often used, Xft. 0:35:17.820,0:35:22.480 Well this is the applications meaning the[br]X clients render the text 0:35:24.060,0:35:27.280 based on FreeType and fontconfig. 0:35:27.800,0:35:31.240 Then the X server[br]only displays the results. 0:35:32.160,0:35:36.140 Well, there is some caching involved, 0:35:36.140,0:35:42.200 and it requires[br]an extension to the protocol. 0:35:51.160,0:35:56.120 In the widget libraries this was also[br]used a long time, 0:35:56.120,0:36:01.540 but now Qt, for example, has it's own[br]code for font rendering 0:36:01.540,0:36:05.240 based on HarfBuzz, FreeType,[br]and fontconfig. 0:36:05.240,0:36:09.140 There's the combination of[br]Pango and Cairo, 0:36:09.140,0:36:13.000 which is used in the GTK environment. 0:36:13.000,0:36:22.660 Pango derives from Greek and Japanese:[br]pan means all and go means languages. 0:36:22.660,0:36:29.660 So this is the background to write[br]in all languages. 0:36:29.660,0:36:34.000 This also uses HarfBuzz, FreeType,[br]and fontconfig. 0:36:34.000,0:36:39.780 And if you look at Wayland clients,[br]they only do client-side rendering. 0:36:42.660,0:36:48.140 To sum it up, we have a variety of[br]techniques for text display. 0:36:50.340,0:36:53.600 Some have historical than[br]practical value nowadays. 0:36:53.600,0:36:58.940 The modern font rendering stack[br]is quite complex. 0:37:03.840,0:37:08.820 But writing is one of the[br]main interface to computers, 0:37:08.820,0:37:12.160 so developers should be aware[br]of the complexity. 0:37:14.460,0:37:16.560 Keep that in mind. 0:37:17.720,0:37:18.540 Thank you. 0:37:20.280,0:37:24.080 [applause] 0:37:33.640,0:37:35.440 Are there any questions? 0:37:41.100,0:37:45.040 [audience] More a request than a question,[br]I find the topic very interesting 0:37:45.040,0:37:51.240 and I'd like to check it again. I know[br]your video was not recorded 0:37:51.240,0:37:53.640 or I think it was not recorded... 0:37:53.640,0:37:57.080 [Max] Well it was I think. 0:37:58.340,0:38:05.320 [audience] Okay so nevermind, but still[br]if you are able to share your presentation 0:38:05.320,0:38:06.160 [Max] Yes 0:38:06.160,0:38:09.440 [audience] I would be[br]very happy to look at it. 0:38:16.960,0:38:25.640 [audience] [tests mic] What's the problem[br]due to the 0:38:25.640,0:38:32.900 compressed ?? from the software stack[br]in your open ??. 0:38:32.900,0:38:36.240 [Max] The problem of what? 0:38:36.240,0:38:48.320 [audience] What's the problem it came from[br]this complex software stack 0:38:48.320,0:38:50.320 in your open ??. 0:38:50.320,0:38:59.420 There's no problem with that,[br]or there's some problem 0:38:59.420,0:39:11.300 with these lot of layers, very lot of[br]components to render the font. 0:39:11.300,0:39:17.440 [Max] Okay, I try to rephrase the question[br][question] Please 0:39:17.440,0:39:22.820 [Max] What is the reason there is so many[br]layers in the font rendering stack today. 0:39:22.820,0:39:23.980 [Max] Is that correct? 0:39:23.980,0:39:38.120 [audience] And it caused some problem. Do[br]you know any problem 0:39:38.120,0:39:41.600 with current rendering system. 0:39:41.600,0:39:43.700 [Max] Colored font rendering system? 0:39:43.700,0:39:45.700 [audience] Current, now. 0:39:48.040,0:39:49.440 [Max] Ah current font- 0:39:49.440,0:39:52.500 [audience 2] The question is[br]whether the complexity 0:39:52.500,0:39:55.520 means that there are[br]difficulties for developers. 0:39:55.520,0:39:56.700 Is it too complex? 0:39:56.700,0:39:58.200 Does that cause problems? 0:39:58.200,0:40:02.640 [Max] Well the complexity is hidden behind[br]the font rendering stack. 0:40:02.640,0:40:10.560 So it's a huge collection of software, 0:40:10.560,0:40:17.620 usually there's HarfBuzz, fontconfig,[br]and FreeType heavily used nowadays. 0:40:17.620,0:40:22.300 But it's all encapsulated[br]in these libraries 0:40:22.300,0:40:29.140 and it's used all over[br]the free software world 0:40:30.240,0:40:39.080 and it makes it easy to write applications[br]which are easily translatable. 0:40:39.840,0:40:47.800 [audience] Yes but for example,[br]the fontconfig is not so flexible. 0:40:47.800,0:40:55.080 For example, when we're using[br]mainly[?] Japanese 0:40:55.080,0:41:01.800 and other display of the language, 0:41:01.800,0:41:13.160 then the font of config chooses the[br]non-Japanese font like the Chinese one. 0:41:13.160,0:41:28.220 I know some distributions like Ubuntu make[br]language specific fontconfig file 0:41:28.220,0:41:36.500 for each language to deal with but[br]Debian doesn't have such a mechanism. 0:41:38.880,0:41:47.800 So in my opinion the fontconfig[br]is a bit terrible so 0:41:47.800,0:41:55.260 is there any ?? meant or any hack for it? 0:41:55.260,0:42:04.760 [Max] Okay, the fontconfig system comes[br]from the time where XML was popular. 0:42:04.760,0:42:06.600 [audience] Mhmm[br][Max] As you can see. 0:42:08.520,0:42:15.360 Well the problem here is[br]not so much the software stack 0:42:15.360,0:42:18.960 more than the Unicode system. 0:42:18.960,0:42:25.300 So in the Unicode system there are[br]same code points for 0:42:25.300,0:42:31.240 Japanese and Chinese characters somewhere[br]although they have different appearances. 0:42:31.240,0:42:39.200 In the fontconfig system there are[br]replacement rules for characters 0:42:39.200,0:42:48.380 and it is just a list and usually Chinese[br]fonts are listed first. 0:42:48.380,0:42:54.540 So that is the reason why in the Japanese[br]language you get Chinese characters 0:42:54.540,0:42:56.620 instead of Japanese characters. 0:42:56.620,0:43:01.760 So I also think there's room to improve[br]the software stack, yes. 0:43:01.760,0:43:03.180 [audience] Thank you. 0:43:15.500,0:43:19.520 [Max] Okay, done. Thank you. 0:43:20.080,0:43:24.640 [applause]