Error when using TextMeasure.measure on some fonts
See original GitHub issuePrerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of Fonts
- I have verified if the problem exist in both
DEBUG
andRELEASE
mode - I have searched open and closed issues to ensure it has not already been reported
Description
Error when using TextMeasure.Measure feauture
-
Fonts version: 1.0.0-beta17
-
Other Six Labors packages and versions:
-
Environment (Operating system, version and so on): Windows 7
-
.NET Framework version: .net core 3.1
-
Additional information:
I recently upgraded SixLabors.Fonts from 1.0.0-beta0009 to 1.0.0-beta17, also I upgraded the imagesharp and imageSharp.Drawing to latest versions and I see that some of the fonts are failing with the following exception
"Invalid value for ‘subTableFormat’ 7294. Should be ‘1’
These were working before I did the upgrade. Following code is throwing the error. And also this is not happening with all the fonts… only few fonts.
AllFontCollection = new FontCollection(); AllFontCollection.Add(@“Fonts/font1.ttf”); AllFontCollection.Add(@“Fonts/font2.ttf”); if (fontCollectionService.AllFontCollection.TryGet(layer.Font.FontName, out FontFamily family)) { // family will not be null here font = family.CreateFont((float)(layer.Font.FontSize * 4), fontStyle); } var textOptions = new TextOptions(font) { WrappingLength = targetWidth };
var textSize = TextMeasurer.Measure(text, textOptions ); //this line throws exception
am I missing anything?
I would really appreciate any direction on this…
Thanks in advance…
Issue Analytics
- State:
- Created a year ago
- Comments:18 (16 by maintainers)
I’ll update my poc to use the same sort of tests to verify this specific font an create a pr today with these changes.
I think that should work, I am in favor of this solution. @JimBobSquarePants what do you think, should we go this route?
I like you creativity with naming, but I think we need another name 😄
Also something we should consider is using the checksum in the table header. We should be able to determine such errors with it.
@loraderon before you start working on this let’s wait what @JimBobSquarePants thinks about it.