cinera_handmade.network/cmuratori/hero/code/code174.hmml

52 lines
4.0 KiB
Plaintext
Raw Permalink Normal View History

[video output=day174 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Adding Sparse Unicode Support" vod_platform=youtube id=pkaKQzq-hrM annotator=Miblo annotator=debiatan]
[0:15][Recap and plan for the day]
[1:48][Spaces are not displayed]
[2:50][Adding the kerning value for space to the kerning table]
[4:05][But wait... that kerning value was already there]
[4:51][Explanation of Casey's previous assumption of what caused the bug]
[5:54][Debugging the asset packer]
[6:26][It seems that the asset packer does not process the space codepoint]
[7:45][The asset packer ignores the space glyph because it has no visible pixels]
[8:17][Spaces are back but we have lost the small letters]
[8:18][Run Handmade Hero, although...][quote 190]
[8:50][Fixing a bug introduced while fixing the problem of the visibility of the space glyphs]
[9:38][Checking the width of rendered spaces]
[10:17][Choosing a target foreign string to test the rendering of non-ASCII characters]
[11:21][Checking that Arial has all the necessary codepoints]
[12:11][Finding the codepoints associated to the test string]
[14:52][A table that encompassed the complete range of characters necessary to represent both ASCII and our target kanji would be massive]
[16:10][We need a way of condensing the ranges of available characters]
[16:43][(Blackboard) Layout of the 1-D symbol lookup table]
[18:11][Easiest but slow solution: store the codepoints themselves for each row of the table]
[19:22][What about preprocessing every string to store the indices to the glyph tables instead of the characters?]
[22:02][Or we can simply store one big table that maps each character to its associated glyph index]
[23:03][Any objections?][quote 191]
[23:27][Storing pairs of codepoints and bitmap_ids instead of just bitmap_ids]
[24:40][The new codepoint table will be decompressed at runtime and used as a direct lookup table]
[25:31][Let's implement that]
[30:50][Adding the kanji owl characters by hand to the asset file]
[31:20][Do AddCharacterAsset for the Kanji Owl straight after adding the other font Assets][quote 192]
[32:14][Modifying the code that uses plain characters to use glyph indices instead]
[32:42][Setting a maximum glyph count]
[37:07][Fonts are done][quote 193]
[38:02][Using a huge table at asset pack time to map every Unicode codepoint to our glyphs]
[43:25][Freeing memory associated to the loaded_font variables]
[43:59][Propagating the last changes through the code]
[44:51][We can't refer to the kerning of a pair of glyphs until we have mapped both glyphs]
[49:18][Modifying the HorizontalAdvance table as the last step before writing the font to the asset file]
[52:01][(Blackboard) Writing only the part of the HorizontalAdvance table that we'll use]
[53:04][Starting to implement the partial storage of the HorizontalAdvance table]
[56:12][On freeing things][quote 194]
[56:21][Leaving the code in a compiling state before the end of the stream]
[59:07][Q&A][:speech]
[59:26][@bkboggy][I noticed that you rarely comment your code. Your comments mostly consist of TODO comments. What are your thoughts on commenting your code, considering a lot of it is pretty complicated, unless of course you don't see it as such? Or do you think that since you write good code, it doesn't require comments to be readable?]
[1:01:59][@robrobby][Why was your first calculation of the GlyphTable index size too big (64k) and reduced to 2k, and still later went full-on 64k again? What changed the size?]
[1:02:54][@ijustwantfood][Would it be a good practice to comment after writing all your code for others?]
[1:05:57][@cubercaleb][Since the questions are slow today, when do you think you will write a proper RNG?]
[1:06:13][@pseudonym73][Or a real hash function?]
[1:07:06][@jameswidman][My comment-writing rule for a while has been: "code should clearly tell you what is being done; comments, if you need them, should only tell you why"]
[1:07:55][@drmumba][How long have you been coding (years)?]
[1:08:03][@abnercoimbre][When will you implement the chocolate wine fountain?]
[1:08:39][Call it][:speech]
[/video]