Fix parsing SVG fonts.

This commit is contained in:
Roman Telezhynskyi 2024-07-12 14:46:34 +03:00
parent 12f17d5961
commit 991b6be9ef
2 changed files with 8 additions and 10 deletions

View file

@ -5,6 +5,7 @@
- Duplicate controls for main path nodes. - Duplicate controls for main path nodes.
- Fix compatibility with macOS 12+. - Fix compatibility with macOS 12+.
- Fix regression. Formula wizard dialog doesn't show item alias in a list. - Fix regression. Formula wizard dialog doesn't show item alias in a list.
- Fix parsing SVG fonts.
# Valentina 0.7.53 June 25, 2024 # Valentina 0.7.53 June 25, 2024
- Fix layout sheet export with empty name. - Fix layout sheet export with empty name.

View file

@ -298,15 +298,7 @@ auto VSvgFontReader::ReadFont() -> VSvgFontEngine
SetFontFace(&font); SetFontFace(&font);
engine = VSvgFontEngine(font); engine = VSvgFontEngine(font);
} }
else else if (name() == "missing-glyph"_L1 || name() == "glyph"_L1)
{
skipCurrentElement();
}
}
while (readNextStartElement())
{
if (name() == "missing-glyph"_L1 || name() == "glyph"_L1)
{ {
ParseSvgGlyph(&engine, attributes()); ParseSvgGlyph(&engine, attributes());
} }
@ -362,7 +354,7 @@ void VSvgFontReader::SetFontFace(VSvgFont *font)
QString const fontStyle = fontFaceAttr.value("font-style"_L1).toString(); QString const fontStyle = fontFaceAttr.value("font-style"_L1).toString();
QString const fontWeight = fontFaceAttr.value("font-weight"_L1).toString(); QString const fontWeight = fontFaceAttr.value("font-weight"_L1).toString();
QString fontName; QString fontName = fontFamily;
while (readNextStartElement()) while (readNextStartElement())
{ {
@ -373,12 +365,15 @@ void VSvgFontReader::SetFontFace(VSvgFont *font)
if (name() == "font-face-name"_L1) if (name() == "font-face-name"_L1)
{ {
fontName = attributes().value("name"_L1).toString(); fontName = attributes().value("name"_L1).toString();
readElementText();
} }
else else
{ {
skipCurrentElement(); skipCurrentElement();
} }
} }
readElementText();
} }
else else
{ {
@ -393,6 +388,8 @@ void VSvgFontReader::SetFontFace(VSvgFont *font)
font->SetDescent(descent); font->SetDescent(descent);
font->SetStyle(ParseFontStyle(fontStyle)); font->SetStyle(ParseFontStyle(fontStyle));
font->SetWeight(ParseFontWeight(fontWeight)); font->SetWeight(ParseFontWeight(fontWeight));
readElementText();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------