oakmound / oak

A pure Go game engine
Apache License 2.0
1.52k stars 84 forks source link

render/font: Enforce default truetype font height for Height() #209

Closed Implausiblyfun closed 2 years ago

Implausiblyfun commented 2 years ago

Currently when a font is generated from a fontgenerator that has fontsize as 0 it will overwrite it with the value of 12 (as per truetype). However the height method on a font calls the gen referenced(which is a pointer so could change which is interesting in and of itself). At font generation time the size change is only set on the font itself rather than the generator so we return a 0 instead of a 12 prior to this change.

codecov-commenter commented 2 years ago

Codecov Report

Merging #209 (80d3cfd) into master (3325adc) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #209   +/-   ##
=======================================
  Coverage   95.01%   95.02%           
=======================================
  Files         143      143           
  Lines        6344     6346    +2     
=======================================
+ Hits         6028     6030    +2     
  Misses        285      285           
  Partials       31       31           
Impacted Files Coverage Δ
render/font.go 100.00% <100.00%> (ø)

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

200sc commented 2 years ago

Will merge after tests pass.