Skip to content
Permalink
Browse files
Change the type of SVGToOTFFontConverter::m_weight to be not a char
https://bugs.webkit.org/show_bug.cgi?id=183339

Reviewed by Alex Christensen.

No new tests because there is no behavior change.

* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendOS2Table):
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):


Canonical link: https://commits.webkit.org/199041@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229328 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
litherum committed Mar 6, 2018
1 parent ec5ca87 commit 20ef3b5d1d9675dcdb9cbec9c6c557c4cd9e1fe6
Showing with 17 additions and 4 deletions.
  1. +13 −0 Source/WebCore/ChangeLog
  2. +4 −4 Source/WebCore/svg/SVGToOTFFontConversion.cpp
@@ -1,3 +1,16 @@
2018-03-06 Myles C. Maxfield <mmaxfield@apple.com>

Change the type of SVGToOTFFontConverter::m_weight to be not a char
https://bugs.webkit.org/show_bug.cgi?id=183339

Reviewed by Alex Christensen.

No new tests because there is no behavior change.

* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::appendOS2Table):
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):

2018-03-06 Antoine Quint <graouts@apple.com>

[Web Animations] Add a new CSSAnimation subclass of WebAnimation
@@ -264,7 +264,7 @@ class SVGToOTFFontConverter {
int m_descent;
unsigned m_featureCountGSUB;
unsigned m_tablesAppendedCount;
char m_weight;
uint8_t m_weight;
bool m_italic;
bool m_error { false };
};
@@ -499,7 +499,7 @@ void SVGToOTFFontConverter::appendOS2Table()

append16(2); // Version
append16(clampTo<int16_t>(averageAdvance));
append16(clampTo<uint16_t>(m_weight)); // Weight class
append16(m_weight); // Weight class
append16(5); // Width class
append16(0); // Protected font
// WebKit handles these superscripts and subscripts
@@ -525,7 +525,7 @@ void SVGToOTFFontConverter::appendOS2Table()
for (auto& segment : segments) {
bool ok;
int value = segment.toInt(&ok);
if (ok && value >= 0 && value <= 0xFF)
if (ok && value >= std::numeric_limits<uint8_t>::min() && value <= std::numeric_limits<uint8_t>::max())
panoseBytes[numPanoseBytes++] = value;
}
}
@@ -1461,7 +1461,7 @@ SVGToOTFFontConverter::SVGToOTFFontConverter(const SVGFontElement& fontElement)
bool ok;
int value = segment.toInt(ok);
if (ok && value >= 0 && value < 1000) {
m_weight = (value + 50) / 100;
m_weight = std::max(std::min((value + 50) / 100, static_cast<int>(std::numeric_limits<uint8_t>::max())), static_cast<int>(std::numeric_limits<uint8_t>::min()));
break;
}
}

0 comments on commit 20ef3b5

Please sign in to comment.