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

58 lines
3.7 KiB
Plaintext
Raw Permalink Normal View History

[video output=day164 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Asset Processing with Windows Fonts" vod_platform=youtube id=KF0jRm89bRM annotator=Miblo annotator=debiatan]
[0:02][Recap and plan for today]
[1:43][Reasons for and against using libraries in the asset processor]
[4:19][Windows calls to draw fonts]
[6:11][GetPixel: Simplest way of getting the rendered font, pixel by pixel]
[7:06][CreateCompatibleDC and CreateCompatibleBitmap]
[8:46][Defining an alternative code path inside LoadGlyphBitmap to render fonts via Windows calls]
[9:51][TextOut: Drawing text to an HDC]
[11:21][Creating the device context]
[12:20][CreateCompatibleBitmap]
[14:00][We are not using the right font yet]
[14:23][This is a zygote of a thing][quote 160]
[15:14][Finding out space taken by the text]
[15:58][GetTextMetrics]
[16:48][GetTextExtentPoint32]
[18:18][Clearing the background prior to writing the glyph: Patblt]
[20:22][SetTextColor]
[21:28][Try doing some extraction][quote 161]
[21:48][GetPixel: Extraction of the glyph]
[23:50][Recap of previous steps]
[25:24][Test out this alternative font implementation][quote 162]
[25:57][Debugging it]
[26:50][No need to debug; Casey remembers the cause of the problem]
[27:36][SetBkmode: Setting the background filling behavior]
[28:29][Selecting a background brush instead of calling PatBlt]
[29:18]['Doopity Doo' by Casey Muratori][quote 163]
[29:55][SetDCBrushColor]
[30:28][Let's test it]
[31:35][Setting the background color with SetBkColor]
[32:13][Success!]
[32:50][CreateFont: Picking the font]
[34:31][AddFontResourceEx: Making the font visible to windows]
[37:26][We need to specify the font name]
[44:52][We also need to mark the font as active]
[45:44][Testing the renderer with a more recognizable font]
[46:54][Back to STB font rendering for a minute]
[47:52][Resorting to solid alpha to inspect the bounding boxes]
[52:54][Scanning the bitmap to get the bounding box of the glyph manually]
[57:41][Adding a one-pixel empty border]
[59:40][Q&A][:speech]
[1:00:19][@insofaras][Can the fonts have outlines?]
[1:00:43][@gasto5][What did you mean by "backing bitmap"?]
[1:03:16][@cubercaleb][I love how stb_truetype is easier and arguably better than the windows api version]
[1:03:24][@ThisisAtticus][Vote on the strawpoll!]
[1:04:43][@Robrobby][Does windows font have subscript and superscript support and therefore so much overbounding? Also, is the anti-alias only stored in the alpha value by windows? After seeing a pro like you struggle with this API I understand the burden you go through with it, having seen STB yesterday]
[1:06:10][@insofaras][To clarify, do we have the ability to create font bitmaps with outlines on the characters that could maybe be colored separately?]
[1:07:22][@gasto5][Which one is worse: GDI or DirectInput8?]
[1:07:34][@quartertron][Is today a good example of why sometimes using a library is okay?]
[1:10:11][@SoysauceTheKid][Would DirectWrite (or ClearType) help out with the anti-aliasing?]
[1:10:25][@plain_flavored][Ignore this if you're already doing this, but why not ship the mono bitmap as part of the asset file instead of the much larger RGBA bitmap?]
2017-12-24 00:16:27 +00:00
[1:11:56][@abnercoimbre][Q: People are liking the idea of handmade.dev]
[1:12:35][@Robrobby][How often do you regret using a API/lib and back-up writing your own implementation? When you are fast-paced as you maybe this sometimes is better when your knowledge of the problem is sufficient]
[1:14:29][@BonusRocket][What GUI toolkit do you recommend?]
[1:15:12][@SoysauceTheKid][Would CLEARTYPE_QUALITY instead of ANTIALIASED_QUALITY make a difference?]
[1:15:30][Blackboard: LCD pixel elements]
[1:17:12][That's all she wrote][:speech]
[/video]