[video output=day528 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Writing HHTs from HHFont" vod_platform=youtube id=yzLKupv6Oy0 annotator=Miblo]
[0:00][Recap and set the stage for the day processing fonts][:"asset system" :font :speech]
[1:46][Demo hhfont with thoughts on localisation][:admin :"asset system" :font]
[7:16][Walk through the hhfont utility][:"asset system" :font :research]
[9:08][Run hhfont with a full complement of arguments][:admin :"asset system" :font]
[10:55][Set up ExtractFont() to write out our :font metadata to .hht and rendered glyphs to directory][:"asset system" :"file io"]
[16:05][Introduce Sanitize()][:"string manipulation"]
[19:11][Enable ExtractFont() to export our :font metadata to .hht][:"asset system" :"file io" :"file format"]
[28:12][Hello @Molly][:speech]
[29:06][Continue to enable ExtractFont() to export our :font metadata to .hht][:"asset system" :"file format"]
[31:38][No scratching, @Molly][:speech]
[32:37][Fix up compile errors]
[33:05][Run hhfont and check out the glyph and HorizontalAdvance data in our .hht to find that the latter is always an integer][:"admin" :"asset system" :"file format"]
[35:26][Change ExtractFont() to output the HorizontalAdvance as an unsigned int, and typeset the block in rows of 16][:"asset system" :"file format" :font]
[38:37][Run hhfont and check out the block of HorizontalAdvance data][:"admin" :"asset system" :"file format"]
[38:51][Prettify the HorizontalAdvance output in ExtractFont()][:"asset system" :"file format" :font]
[39:16][Check out our HorizontalAdvance block][:"admin" :"asset system" :"file format"]
[39:38][Set up ExtractFont() and LoadGlyphBitmap() to call our soon-to-write WritePNG()][:"asset system" :font]
[46:16][Introduce WritePNG() to export our rendered :font glyphs (initially to .bmp)][:"asset system"]
[49:28][Try it out and check out our .bmp rendered glyphs][:"asset system" :font]
[50:27][Reacquaint ourselves with ParsePNG() and the PNG spec[ref
    site=W3C
    page="Portable Network Graphics (PNG) Specification (Second Edition)"
    url=https://w3.org/TR/2003/REC-PNG-20031110/]][:"asset system" :"file format" :research]
[57:25][Implement WritePNG() guided by ParsePNG()[ref
    site=IETF
    page="DEFLATE Compressed Data Format Specification version 1.3"
    url=https://www.ietf.org/rfc/rfc1951.txt][ref
    site=W3C
    page="Portable Network Graphics (PNG) Specification (Second Edition)"
    url=https://w3.org/TR/2003/REC-PNG-20031110/]][:"asset system" :"file format"]
[1:22:10][Enable WritePNG() to write out an IEND chunk and temporarily blank four-byte CRC[ref
    site=W3C
    page="Portable Network Graphics (PNG) Specification (Second Edition)"
    url=https://w3.org/TR/2003/REC-PNG-20031110/]][:"asset system" :"file format"]
[1:26:00][Try out hhfont to find that our rendered .png files are sized correctly][:admin :"asset system" :"file format"]
[1:27:53][Add test_png to ~remedybg][:admin]
[1:30:27][Run test_png on a newly exported .png and step through ParsePNG() to see what it processes][:"asset system" :"file format" :run]
[1:32:40][Make WritePNG() write out the BTYPE][:"asset system" :"file format"]
[1:34:00][Step through test_png's ParsePNG() to find our correctly set BTYPE][:"asset system" :"file format" :run]
[1:34:35][Fix WritePNG() to write out the BTYPE as part of the BFinalType byte][:"asset system" :"file format"]
[1:35:24][Step through test_png's ParsePNG() to find that the while(LEN) loop cannot be correct][:"asset system" :"file format" :run]
[1:39:19][Fix ParsePNG() to consume the correct length of pixels][:"asset system" :"file format"]
[1:39:53][Step on through test_png's ParsePNG() to find that we do not fill all our expected pixels][:"asset system" :"file format" :run]
[1:41:18][Make WritePNG() output the pixels in rows, prepending each one with a filter value][:"asset system" :"file format"]
[1:44:05][Step through ParsePNG() to find that we still underflow][:"asset system" :"file format" :run]
[1:44:22][Fix the Len computation in WritePNG()][:"asset system" :"file format"]
[1:44:49][Step on through test_png's ParsePNG() to completion][:"asset system" :"file format" :run]
[1:45:58][Fix WritePNG() to correctly offset the pixels of each row][:"asset system" :"file format"]
[1:46:22][Export our .png glyphs to find that they remain incorrect][:admin :"asset system" :"file format"]
[1:47:53][Q&A][:speech]
[1:48:40][@somebody_took_my_name][Q: The IEND footer is missing some swaps][:"file format"]
[1:48:43][Fix WritePNG() to endian-swap the IEND chunk][:"asset system" :"file format"]
[1:49:03][@spatialfree][Q: I love that "vertical header peek" in your ~4coder editor. Is it a default feature? How can I get it?]
[1:50:14][@somebody_took_my_name][Q: Is the RGBA the same for bitmaps and PNGs?][:"file format"]
[1:51:23][@euphius][Q: Do you think machine learning can be useful in games? If yes, in what way?][:ai]
[1:53:37][@osor_io][@handmade_hero Will we be able to get your current ~4coder? With the new version coming out and maybe the sources for yours on the [~hero Handmade Hero] files? I keep doing things that you seem to have done already and, damn man, I'd love to have it]
[1:55:35][@boonetbe][Q: I see quite a lot of people moving into more programming / software engineering related jobs after doing some academical research, not at all focussed on CE related things (physics, chemistry, etc). Do you have any experience working with people that didn't focus on coding for a long time, possibly not having any real training in it? What's the biggest difference with people that have a degree in CE or focused on programming from a young age?]
[1:56:52][@jkfsda][Q: Do you feel like explicit languages make people more productive compared to expressive languages? I think functional programmers program just for masturbatory purposes][:language]
[1:59:37][@jbcgannon][Q: You've talked in the past about understanding the trade-offs in software development such as: optimizing increasing complexity; time constraint in the context of readability vs features implemented. Are there other things you keep in mind when deciding how to spend your time?]
[2:02:05][@x13pixels][Yak Shaving. New term learned]
[2:04:31][@tbodt_][Q: Why not use stb_image to save PNGs instead of writing your own?][:ai :library]
[2:09:38][@ivereadthesequel][@handmade_hero That's why you need to get on the writing-robots bandwagon!][:ai]
[2:14:06][@joeyiswatching][Q: Do you have a std\:\:vector / dynamic array replacement, or are you also not using std\:\:?][:library]
[2:14:47][@tripl3m][Q: Hello, probably answered before, but I wish to use C99 with MSVC, but heard it is not so well supported by Microsoft. Could it be an issue for programming in C with Windows?][:language]
[2:15:33][Stack Overflow-oriented :AI][:speech]
[2:17:14][@saidwho12][Some guy on twitch was writing a vim plugin that you ask questions to and it would look on Google or in a database for code, and paste it on your cursor][:ai]
[2:21:50][Call it quits][:speech]
[/video]
