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

67 lines
5.8 KiB
Plaintext
Raw Permalink Normal View History

[video output=day173 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Precise Font Alignment" vod_platform=youtube id=xSDhhfcwt4E annotator=Miblo annotator=debiatan]
[0:14][Recap and plan for today]
[1:46][Review of last episode]
[2:15][The first line should start one line down from the top of the screen]
[4:47][We want to be able to access the LineAdvance information without having to load the font]
[5:38][The placement is not correct yet]
[7:15][The zero Y is at the center of the screen, not the edge]
[7:39][Testing multiple sizes inside a word]
[8:54][We don't have the necessary information to do kerning between characters of different sizes]
[9:26][(Blackboard) Explanation of the problem]
[12:24][Our Kerning tables don't specify the initial horizontal offset in the absence of a preceding glyph]
[13:50][Special-casing the kerning for the null glyph in the asset packer]
[15:02][Fix the variable shadowing][quote 173]
[15:13][Still not lining up with the left edge and upper edges]
[15:51][Lining up with the top edge by looking at the ascenders and descenders of the font]
[21:51][The characters still don't line up with the top edge, but it's because the font includes glyphs taller than the ones we are displaying]
[23:46][Aligning the text with the left edge. Baking the leading space into the kerning]
[25:55][Processing the characters before the fonts to have access to the necessary information]
[30:38][Compare kerning][quote 174]
[32:03][The ABC's A was already included in the horizontal advance]
[33:05][The kerning is still not quite right]
[33:45][Using our own measurement of the width of the character instead of the ABC's B]
[35:46][Debugging some more]
[40:49][Checking the documentation of the ABCs]
[43:42][(Blackboard) Thinking some more about the problem]
[45:04][In order to be able to flush-align all characters to the left, the prestep of the current character should be applied to the next character!]
[47:45][Subtracting our kerning adjustment from the previous character]
[49:45][No kerning for characters following the null codepoint]
[50:57][Is it even possible to match Windows' kerning exactly?]
[51:30][We'll have to compress the font ranges to support kerning for other languages]
[55:51][Q&A][:speech]
[57:01][@Miblo][The more I see the kerning in Notepad, compared to yours, the more awful it looks to me]
[57:24][@Pseudonym73][I realise that this is uncharted territory, but it seems to me that font rendering is taking more time than the rest of the renderer. Is that normal?]
[1:00:29][@dmitsuki][Isn't Japanese evenly spaced?]
[1:00:52][@abnercoimbre][Migraine \:(. Glad to at least catch the Q&A]
[1:01:09][@Robrobby][I was testing kerning in Notepad, Word, Wordpad... No kerning there? Where do you have seen kerning in Windows?]
[1:01:26][@TheSizik][Don't forget the boilerplate]
[1:01:32][@dmitsuki][John Carmack programmed low level graphics and got a Ferrari. Font rendering guy never got anything. When are we going to go back to programming cool superstar things?]
[1:02:44][@NexMetu][I'm in my second year at uni for programming, and I still have problems getting my head around single things. My question is how long did it take you to have a good understanding of programming in general?]
[1:03:11][@Pseudonym73][Fair enough. Maybe it just seems like progress is slower for some definition of "progress"]
[1:03:42][@graeme7][I'm confused why the font rendering relies so much on windows. Isn't all this stuff stored in the font files, or is that harder without Windows text metrics and such? Or, to put it another way, how would what we did today be different if we were using stb_truetype?]
[1:04:18][@Robrobby][On the MSDN entry "Uniscribe Glossary" ABC Values is better explained how Windows understands it]
[1:07:00][Ignore the documentation and just do GetCharWidth32]
[1:08:13][See how that kerning looks]
[1:10:10][@Danyguag][Do you use the graphics card at all when rendering?]
[1:10:26][@Childz][I'm sure this has been answered so feel free to ignore if true. What are the features of C++ that you use that keep you from using just plain old C?]
[1:10:52][@Robrobby][When you say Windows uses kerning, why is every letter never overlapping in the space of the followed letter? In your code I see the letters overlapping. Did I understand kerning wrong?]
[1:11:36][@dmitsuki][O-oh yeah, well, John Carmack also got to make Rocketships, so he wins]
[1:12:03][@cubercaleb][Are you saying Adobe has better programmers than Id?]
[1:13:01][@dmitsuki][Why didn't we use bitmap fonts and used TTF? Bitmap fonts are cross platform, are they not?]
[1:13:36][@GameDeve][When I render on a GPU, is there a way without copying the render result back to RAM?]
[1:14:04][@jooda12][Japanese isn't evenly spaced. Some characters like 「 and 」 rely on kerning]
[1:14:57][@Danyguag][How do you render to the GPU?]
[1:15:27][@guit4rfreak][Favorite font for reading?]
[1:15:44][@GameDeve][To display the result]
[1:16:34][@gasto5][I almost got a headache when you said alignment is not the same as kerning, please expound]
[1:16:51][Blackboard: Spacing vs. Kerning]
[1:20:14][@cubercaleb][Would you rather have a CPU with more cores than a GPU, or enough clock cycles to outperform the GPU with software rendering?]
[1:20:32][@jooda12][You can look here[ref
site="W3C"
page="Requirements of Japanese Text Layout (English version)"
url="http://www.w3.org/2007/02/japanese-layout/docs/aligned/japanese-layout-requirements-en.html#en-subheading1_2_3"], 3. Tsumegumi for Japanese kerning]
[1:22:23][@Robrobby][When thinking Adobe has a market value of over 40billion, why no great programmer wants to do a better Photoshop?]
[1:24:40][@dmitsuki][There are actually a lot of people competing with Photoshop, and you are using one of those products on stream right now...]
[1:26:01][Wind it down][:speech]
[/video]