[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Extracting Kerning Tables from Windows" vod_platform=youtube id=xUQRWBpYcsk annotator=Miblo annotator=debiatan] [0:48][Recap and plan for today] [2:43][There's a bug that prevents the fonts from loading] [3:37][Writing fonts in a separate asset file] [6:10][Stepping through the asset packer] [12:53][We were not setting the horizontal advance correctly. For the moment, we'll just hardcode it to be the width of the current character] [16:35][We were using the incorrect AssetType for our font glyphs] [18:50][Testing and still not loading] [19:01][Stepping through the asset loading code] [21:16][Take it back][quote 182] [21:45][On getting older][quote 183] [22:16][Debugging LoadFont] [22:43][We were not calling LoadFont yet!] [23:39][Implementing PushFont] [27:00][The fonts are back!] [28:17][Let's look for the correct kerning pair values] [29:46][Reviewing the GetKerningPairs docs] [31:10][Figuring out the number of kerning pairs] [32:09][Getting the kerning pairs] [33:20][Structure of tagKERNINGPAIRs] [36:03][What is the default advance?] [41:18][Question the ABCs][quote 184] [41:33][Checking the system header files to see which functions and struct offer wide-character alternatives] [43:23][Debugging the LoadFont crash] [45:30][GetCharABCWidthsW expects a range, not a count] [46:00][Our fonts look nicer now] [47:06][Using the ABC's A information to modify the alignment of our glyphs] [48:13][(Blackboard) Diagram of the alignment point calculation] [49:32][Our fonts look even better] [51:13][The fonts still look bad, but it's Windows' fault] [52:28][See how Segoe Condensed looks][quote 185] [53:06][Windows fonts make a fontographer cry][quote 186] [54:27][We still have to see how our glyph bounding box detection interacts with the system's kerning information] [57:01][The alignment based on the bounding boxes was already correct and we didn't need the ABCs] [1:00:30][Modifying the TextOutW call in the asset packer to allow Windows to paint glyphs to the left of the specified drawing point in the font Device Context] [1:03:14][Q&A] [1:03:37][@Robrobby][Could you use another text sample like "AVA WA Ta"] [1:04:22][Learn something new about Arial and Helvetica] [1:06:22][@bkboggy][How do you know so much about fonts?] [1:07:26][@ChronalDragon][Do you typically license fonts for use in games? Or does the loophole about rendering them to bitmaps mean you can just use whatever you want?] [1:07:48][Recommend Google Fonts[ref site="Google" page="Google Fonts" url="https://www.google.com/fonts"][ref site=GitHub page="Google Fonts Files" url=https://github.com/google/fonts]] [1:10:26][@abnercoimbre][Is fonts a topic you enjoy? An author once wrote: "If music is the subjective application of physics, then font rasterisation is almost certainly the subjective application of computer science." Do you agree?] [1:11:10][@QuikliGames][Probably doesn't make sense to look at kerning for lowercase to Uppercase. I doubt many fonts bother with those cases] [1:12:05][@ijustwantfood][Would Times New Roman be any better?] [1:12:10][@JamesWidman][What are some examples of font / typesetting systems that can do kerning well? Is Knuth's TeX the only game in town?] [1:14:14][@bkboggy][Hmm... good point. More game designers should have a guy / gal who knows about fonts, because I see lots of games where it's hard to read quest text / chat text] [1:15:18][@abnercoimbre][Regarding the abstract text, I agree! Which is why I asked. Given your experience, maybe you could've read more into that than I could] [1:15:51][@Robrobby][The down-left corner of the "A" is cut, but you search bounds by the pixels, so why did this happen?] [1:16:33][@quartertron][Have you played Facade and / or met the designers?] [1:18:09][Clear everything to black instead of white] [1:20:54][@Robrobby][You said Molly Rocket's upcoming game has crazy font functions - can you say one example what about fonts can be crazy? Just wondering] [1:21:12][@quartertron][What's behind the curtain?] [1:21:24][@garlandobloom][Facade was kinda interesting. One time I typoed the first thing I said to the guy when he opened the door and he just scowled, shut the door in my face and then the game faded to black and ended] [1:21:46][Check our edges] [1:22:23][Close things down here] [/video]