Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Unreadable font when testing wx-master
oBFusCATed:
Probably commit 228cd926e27589ee514682513cc8d89aabc9a603 in wxWidgets is causing the problem or is fixing the problem. I don't know. You'll have to test. If it is something caused by wxWidgets, we have to report it.
Does setting the font with a night build (which uses 3.1.1) and then switching to a build using wx-master works correctly?
Miguel Gimenez:
If I open the nightly I get MS Sans Serif - Normal - Blank size
Opening CB-head with wx-head I get Fira Code - Normal - Size 10
Both cases use the same default.conf and I get a micro font.
In both cases changing anything in the font fixes the issue.
The last four changes to src/mws/font.cpp were in fact related to font sizes, I will check.
EDIT: 3.1.1 saves fonts in V0 format, the rest in V1. The difference is a new parameter, next to the version, with the point size:
3.1.1: <![CDATA[0;-13;0;0;0;400;0;0;0;0;3;2;1;49;Fira Code]]>
3.1.2: <![CDATA[1;0;-13;0;0;0;400;0;0;0;0;3;2;1;49;Fira Code]]>
3.1.3: <![CDATA[1;9.75;-13;0;0;0;400;0;0;0;0;3;2;1;49;Fira Code]]>
The font saved by 3.1.2 has a 0 point size, while the 3.1.3 one has 9.75. This V1 string with 0 point size is what causes the problem.
The font size is read in line 670 of src/msw/font.cpp, but it is not validated; probably line 690 should be changed from
--- Code: ---if ( setPointSizeFromHeight )
pointSize = GetPointSizeFromLogFontHeight(l);
--- End code ---
to
--- Code: ---if ( (pointSize == 0.0) || setPointSizeFromHeight )
pointSize = GetPointSizeFromLogFontHeight(l);
--- End code ---
I will check if this fixes the issue
Miguel Gimenez:
OK, the patch works. I will open a ticket in wx site.
The problem is:
- wx3.1.1 uses v0 format for font-to-string conversion. It doesn't understand v1, so using a wx3.1.2 or newer C:B "corrupts" the font information in default.conf because they save it in v1 format, so wx3.1.1 reverts to a default font (MS Sans Script - Normal - Blank size).
- wx3.1.2 saves in v1 format but read both. The problem is it saves a 0 point size, but it "corrects" this recalculating the size on load.
- wx3.1.3 is like 3.1.2, but it uses the value read without checking, so fonts saved with wx3.1.2 will get a near zero size (the closest practical size).
Jumping directly from 3.1.1 to 3.1.3 does not have issues, because 3.1.3 will read the v0 format.
This is a problem normal users won't see because they stick to nightlies, but devs and others like me will find soon or later when changing back and forth between versions.
oBFusCATed:
I'm not sure there is long a term benefit to fix this. The only real issue we should care is moving from cb+wx3.1.2 to cb+wx<3.1.2 or what happens if we go back to a version which doesn't understand v1 font string?
Miguel Gimenez:
The current nightlies don't understand v1. If you are working with 3.1.2 or newer version you will loose all your font settings when using the nightly, nothing too important. If you mix wxmaster and wx3.1.2 you will then get the micro font, but it also has a simple solution and 3.1.2 has been used only by some people from this forum.
I intend to report this to wx devs because there are more software using wxWidgets that can benefit from this correction.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version