TTT2 icon indicating copy to clipboard operation
TTT2 copied to clipboard

Fonts: Rework

Open TimGoll opened this issue 1 year ago • 3 comments

This is an issue with multiple things that should be changed for fonts. This can happen over multiple PRs

  • Switch from Tahoma to a different font that is distributed with TTT2. Currently OpenSans seems like a good canidate
  • Move all font creation to a single file, that way we might be able to remove some duplicates
  • Re-/Create fonts in TTT2FinishedLoading so that our advanced font system is hotreload safe

Idea: Don't pregenerate advanced fonts for 1.0, 1.5 and 2.0 scale but generate the fitting font on scale change. So if you set the scale to 1.3, all fonts are regenerated to use that scale. We might have to support the old system still, because some addons might use it

TimGoll avatar Feb 09 '24 11:02 TimGoll

the main thing is that we generate a font starting from the global scale, so that the initial font selected is not stretched, like on 1.7: gmod_vN624aaBSH vs 2.0 (applied same-session): gmod_CP4fU1NVzu vs 2.0 (applied after a map restart): gmod_UrerlAPqGn

and for the "breakpoint" font sizes to correspond with a multiple of the initial font size, e.g. 1.7, 2.55, 3.4, 4.25 and we use those scales when the requested font scale is 1, 1.5, 2.0, 2.5 so that they're crisp as well

internally, i believe nearly all the font scale calls are using one of the preset breakpoints

EntranceJew avatar Feb 09 '24 11:02 EntranceJew

internally, i believe nearly all the font scale calls are using one of the preset breakpoints

internally we only use the 1.0 scale, or the scale defined with the slider. We never increase a font by using a scale factor. So if we were to recreate fonts on scale change, we only would need a single font

TimGoll avatar Feb 09 '24 11:02 TimGoll

TTT2_OS_SC_SB.zip also here's the font i edited the name to if we wanted to use Open Sans SemiCondensed SemiBold across the board, i renamed it to TTT2_OS_SC_SB and that's what the CreateFont declaration should call it as well

EntranceJew avatar Feb 09 '24 11:02 EntranceJew