Open Mamong opened 1 year ago
That only allows it to parse but you are missing the conversion to points. Please send a change request with you changes/additions
@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