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
in "NSCharacterSet+HTML.h"
replace _cssLengthUnitCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"pxtem"];
to _cssLengthUnitCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"pxtrem"];
in "NSString+CSS.h"
replace if ([numberUnitStr isEqualToString:@"em"] | [numberUnitStr isEqualToString:@"px"] | [numberUnitStr isEqualToString:@"pt"])
to if ([numberUnitStr isEqualToString:@"em"] | [numberUnitStr isEqualToString:@"px"] | [numberUnitStr isEqualToString:@"pt"] | [numberUnitStr isEqualToString:@"rem"])
add below
else if (ch == 'r') {
// rem
if (i<stringLength)
{
if (_characters[i++] == 'e')
{
if (i<stringLength)
{
if (_characters[i++] == 'm')
{
// rem value
// this is just a workaround. FIXME: rem should be calculated as 'value *= root element font-size'
value *= textSize;
}
}
}
}
}
else if (ch == 'e')
The text was updated successfully, but these errors were encountered:
@odrobnik Hi, I'm writting an epub reader, then I run into a problem with one epub file. The font size of some content is just 1.00pt. I find the problem is that DTCoreText does not parse rem correctly. I fix it with my patch as above. But, I dont know how to get the 'root element' font-size. According to the defination, rem should be calculated as 'value *= root element font-size'. As a workaround, I just make it works like an em.
in "NSCharacterSet+HTML.h"
replace
_cssLengthUnitCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"pxtem"];
to
_cssLengthUnitCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"pxtrem"];
in "NSString+CSS.h"
replace
if ([numberUnitStr isEqualToString:@"em"] | [numberUnitStr isEqualToString:@"px"] | [numberUnitStr isEqualToString:@"pt"])
to
if ([numberUnitStr isEqualToString:@"em"] | [numberUnitStr isEqualToString:@"px"] | [numberUnitStr isEqualToString:@"pt"] | [numberUnitStr isEqualToString:@"rem"])
add below
The text was updated successfully, but these errors were encountered: