From 9610af955baadcbe736b5cc8a9a3b1781b218864 Mon Sep 17 00:00:00 2001 From: Matt Mascarenhas Date: Mon, 22 Apr 2019 21:31:12 +0100 Subject: [PATCH] Annotate hero/code527 --- cmuratori/hero/code/code527.hmml | 57 ++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 cmuratori/hero/code/code527.hmml diff --git a/cmuratori/hero/code/code527.hmml b/cmuratori/hero/code/code527.hmml new file mode 100644 index 0000000..cc4df06 --- /dev/null +++ b/cmuratori/hero/code/code527.hmml @@ -0,0 +1,57 @@ +[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Making a Stand-Alone Font Extractor" vod_platform=youtube id=n8zn2DYjTbU annotator=Miblo] +[0:01][Note our capability to rebuild all of our assets except fonts][:"asset system" :font :speech] +[2:04][Cross-platform :font processing][:"platform layer" :speech] +[5:08][Reacquaint ourselves with our current .hha representation of fonts][:"asset system" :font :research] +[8:05][Exporting fonts to .png format for packing into .hha][:"asset system" :font :research] +[10:08][Spec out a directory structure for developer resources such as fonts][:admin :"asset system" :font] +[11:38][Set up to write fonts out to .png and then into .hht][:"asset system" :font :research] +[15:23][General thoughts on complexity in asset processing systems deriving from complex inter-relationships and structure, as we will find in fonts][:"asset system" :font :speech] +[18:18][Create hha_font.cpp based on test_asset_builder.cpp][:"asset system" :font] +[25:11][Handle command-line arguments and respecify WriteFonts() as ExtractFont()[ref + site="Windows Dev Center" + page="AddFontResourceExA function" + url=https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/nf-wingdi-addfontresourceexa][ref + site="Windows Dev Center" + page="CreateFontA function" + url=https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/nf-wingdi-createfonta]][:"asset system" :font] +[39:42][Introduce the notion of a CHAR_SET_CREATOR to facilitate the creation of various character-set extraction procedures, for localisation][:"asset system" :font] +[51:23][Enable ExtractFont() to call LoadGlyphBitmap() on all the glyphs, making the latter operate on passed in dimensions retrieved from a GetTextMetrics() system call,[ref + site="Windows Dev Center" + page="GetTextMetrics function" + url=https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/nf-wingdi-gettextmetrics][ref + site="Windows Dev Center" + page="TEXTMETRICA structure" + url=https://docs.microsoft.com/en-gb/windows/desktop/api/wingdi/ns-wingdi-tagtextmetrica] and return a glyph_result][:"asset system" :font] +[1:20:41][Clean up compile errors] +[1:29:17][Introduce Include() and IncludeRange() for CHAR_SET_CREATOR functions to call, and a codepoint_mask for ExtractFont() to take][:"asset system" :font] +[1:41:03][:Run hhfont for the first time][:"asset system" :font] +[1:42:55][Print out some :font extraction information][:"asset system"] +[1:44:22][:Run hhafont on some real input, and crash beautifully][:"asset system" :font] +[1:45:06][Add hhfont to ~remedybg and step through it to a crash on fprintf()][:"asset system" :font :run] +[1:48:50][Clear the Mask.CodepointFromGlyph, and prevent Include() from doubly-incrementing through its loop][:"asset system" :font] +[1:50:02][:Run hhafont successfully][:"asset system" :font] +[1:50:24][Fix Include() to only add glyphs whose code point is not 0][:"asset system" :font] +[1:51:10][:Run hhafont to see a more likely glyph count][:"asset system" :font] +[1:51:25][Q&A][:speech] +[1:51:51][@centhusiast][Q: Are you going to implement the PNG writer?] +[1:53:12][@centhusiast][Q: Does the Windows API use Hungarian notation?[ref + site=Wikipedia + page="Hungarian notation" + url=https://en.wikipedia.org/wiki/Hungarian_notation]][:language] +[1:54:04][@recyrillic][Q: We had a yellow ~4coder flash today. Did we know about that color of flash already?] +[1:54:53][@lucid_frost][Q: Do you think you still improve a lot as a programmer (as opposed to when you first started)? I'd be curious to know if there are specific things you work on to keep improving] +[1:59:30][@skytrias][Q: Is it hard to write a level editor? What are the steps? I just want to set positions via mouse, save them so that they're used once exited] +[2:00:10][Demo the game's asset editing :UI][:"asset system" :run] +[2:02:34][@gayonara][Q: What do you mean by better :language?] +[2:04:56][@centhusiast][Q: I really like your programming style of returning a struct from a function and I have been using it a lot. Is it true that it was not possible to return a struct from a function in the early days of C?][:language] +[2:06:52][@basedyam][Q: If you were making a game with a lot of text on-screen, what text :rendering technique do you think you'd go for?] +[2:08:43][@spranklz1][Q: How do you visualize your logic so easily? Sometimes I'll write a complicated function and it will take me, potentially, hours to debug (or fully understand); but that never seems to be a problem for you] +[2:11:22][@se5a1][Q: I keep running into problems that I cannot figure out, but if I drop it and come back to it at a later date (weeks / months), I can sometimes figure out what's going wrong within 10 minutes. Any suggestions on how to improve my problem solving in this regard?] +[2:14:59][@centhusiast][Q: What font do you recommend for a native desktop app? A font that looks pleasant to the eye. I have a hard time finding one. Thanks for your help!] +[2:15:43][@flightlesshippo][Q: What's the hardest programming problem you've found yourself dealing with?] +[2:16:03][@nickito97][Q: Do you ever use Valgrind? Would you recommend it for C (or maybe C++) code? Is there a decent Windows alternative?][:profiling] +[2:17:42][@ud_0][Q: What language / environment do you recommend for introducing young kids to programming?][:language] +[2:21:23][@nickito97][Q: Do you think learning to program with C is a bad idea?][:language] +[2:22:00][@overture2112][Q: How often do you work on random small projects that aren't work-related (i.e. not [~hero Handmade Hero], Molly Rocket stuff, etc)?] +[2:22:40][Close it down][:speech] +[/video]