You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating the atlas with some fonts, I need to set inverseYAxis to true, but I cannot find a way to do this without removing const from GlyphGeometry's getShape() function. My intuition tells me, that there is a good reason for const here, and it shouldn't just be removed. Another option would be to const_cast the shape. This also feels weird, but has the advantage that nothing would have to be changed in this repository.
To clarify, here how I do it:
[...]
// Storage for glyph geometry and their coordinates in the atlas
std::vector <msdf_atlas::GlyphGeometry> glyphs;
[...]
for(msdf_atlas::GlyphGeometry & glyph : glyphs){
glyph.getShape().inverseYAxis = true; // only works if we remove const from GlyphGeometry::getShape()
// or we do a const_cast
msdfgen::Shape & shape = const_cast <msdfgen::Shape &>(glyph.getShape());
shape.inverseYAxis = true;
glyph.edgeColoring(&msdfgen::edgeColoringInkTrap,
3.0, // max corner angle
0); // seed
}
[...]
Is there a better way? If not, what about either an additional non-const function for getShape, or an additional inverseYAxis parameter when loading the glyphs in FontGeometry::loadCharset and GlyphGeometry::load?
I assume I am not the only one running into this, but if you think const_casting is fine, feel free to simply close this issue. Otherwise I'm happy to send you a PR, or, if there is a better way to do this I would greatly appreciate a pointer in the right direction.
The text was updated successfully, but these errors were encountered:
You're right, the font does not need an inverted Y-axis. The error must be in the way that I'm handling the atlas later. When I create an atlas with the same font using standalone msdf-atlas-gen, the Y-axis is fine. This is a bit embarrassing, I should have checked that before. Thank you anyways for having a look.
When generating the atlas with some fonts, I need to set
inverseYAxis
totrue
, but I cannot find a way to do this without removingconst
fromGlyphGeometry
'sgetShape()
function. My intuition tells me, that there is a good reason for const here, and it shouldn't just be removed. Another option would be to const_cast the shape. This also feels weird, but has the advantage that nothing would have to be changed in this repository.To clarify, here how I do it:
Is there a better way? If not, what about either an additional non-const function for getShape, or an additional inverseYAxis parameter when loading the glyphs in
FontGeometry::loadCharset
andGlyphGeometry::load
?I assume I am not the only one running into this, but if you think const_casting is fine, feel free to simply close this issue. Otherwise I'm happy to send you a PR, or, if there is a better way to do this I would greatly appreciate a pointer in the right direction.
The text was updated successfully, but these errors were encountered: