[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Aligning Text to a Baseline" vod_platform=youtube id=fVyzTKCfchw annotator=Miblo annotator=debiatan] [0:08][Recap and plan for today] [2:14][Scaling fonts with respect to the size of the original glyph asset] [5:42][Getting the bitmap dimensions from the hha_asset structure] [7:24][Implementing GetBitmapInfo] [8:15][Drawing text using the original scale of the font] [11:41][We also need to fix the vertical alignment] [12:33][Understanding the cause of our bad horizontal advancing behavior] [14:56][Vertical alignment to a baseline] [15:58][(Blackboard) Baselines] [17:56][Using the asset AlignPercentage field to specify the alignment point] [19:38][LoadGlyphBitmap will write the alignment information in the test asset builder] [20:26][The alignment information is derived from the text metrics] [21:43][(Blackboard) Description of the text metrics we'll use] [23:52][Finding the alignment point of each bitmap] [26:09][Setting the horizontal alignment to the left of the character] [27:25][Vertical alignment using text metrics] [30:27][Testing what we have so far. Still not right] [32:47][Trying to avoid the double flipping in the glyph pixel extraction code to simplify it] [37:31][There's no simple way of doing it while restricting the region of the bitmap we need to scan] [38:05][We're still in janktastic mode][quote 173] [38:40][(Blackboard) Some theories about what's wrong with the vertical alignment] [41:42][Does GetTextExtentPoint32 respect the baseline?] [43:46][Stepping into the code to inspect the metrics values] [45:55][MinY and tmDescent have conflicting values. Are MinY and MaxY flipped?] [47:08][Computing MaxY correctly] [51:45][A heavy brain day at the office][quote 174] [51:56][Vertical alignment works now] [52:30][More consistent horizontal spacing] [53:58][Summary of pending tasks related to font rendering and drawing] [54:30][Applying gamma to correct the alpha blending of fonts] [1:00:03][Q&A][:speech] [1:00:31][@ChronalDragon][Does stb_truetype provide text metrics for this sort of thing? Will you show how to get them from the stb lib on stream?] [1:01:37][@mseery][Will you be covering right-to-left text?] [1:02:05][@TactileDactyl][Do you have any proprietary dependencies?] [1:02:18][@DrLeetClown][What were the things you just took off? I'm assuming something for your wrists] [1:02:25][@RobotChocolateDino][Can you go over how you computed AlignPercentage\[1\] again?] [1:02:43][Blackboard: Computing AlignPercentage\[1\]] [1:09:36][@aeadon][Are you developing this engine with the intent to use it beyond this game?] [1:09:50][@colonparen][Aren't we currently using a fixed-width font? So advancing by some fixed distance (instead of the bitmap width) should improve letter spacing even before discussing kerning in full generality?] [1:10:19][@mseery][Now that you have text handled, will there be a NetHack (ASCII style) mode for Handmade Hero?] [1:10:31][@TactileDactyl][Proprietary dependencies - anything that you need to pay a license fee for to develop or sell copies of the game] [1:12:00][@Mojobojo][Off topic, saved this for the end because I forgot to mention in the beginning. I had a dream with you and Jeff in it. You guys were in my neighborhood on Halloween trick or treating and going door to door asking for candy. At some point I was trying to put on my costume and it got stuck and Jeff was laughing at me] [1:13:24][@Mojobojo][I did forget a question. How did you guys get in my dream?] [1:13:53][@ciastek3214][You could try answering the one I just asked] [1:14:11][@iTz_Kaj][Why not use block-based sprite fonts for debugging and avoid the Windows font headache?] [1:15:13][@mojo123X][What do you use for version control at work?] [1:15:59][@mseery][Who is John Galt?] [1:16:22][Close it down][:speech] [1:16:44][We didn't need those electrons][:speech][quote 175] [/video]