зеркало из https://github.com/SixLabors/Fonts.git
Correctly read woff2 bounds
This commit is contained in:
Родитель
fa8a4c9657
Коммит
5930793285
|
@ -237,7 +237,8 @@ internal static class Woff2Utils
|
|||
}
|
||||
|
||||
// Read the bounding box stream.
|
||||
int bitmapCount = (numGlyphs + 7) / 8;
|
||||
reader.BaseStream.Position = bboxStreamOffset;
|
||||
int bitmapCount = ((numGlyphs + 31) >> 5) << 2;
|
||||
byte[] boundsBitmap = ExpandBitmap(reader.ReadBytes(bitmapCount));
|
||||
for (ushort i = 0; i < numGlyphs; i++)
|
||||
{
|
||||
|
|
Двоичный файл не отображается.
Двоичный файл не отображается.
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) Six Labors.
|
||||
// Licensed under the Six Labors Split License.
|
||||
|
||||
namespace SixLabors.Fonts.Tests.Issues;
|
||||
public class Issues_375
|
||||
{
|
||||
[Fact]
|
||||
public void DiacriticsAreMeasuredCorrectly()
|
||||
{
|
||||
Font font = new FontCollection().Add(TestFonts.PermanentMarkerRegularFile).CreateFont(142);
|
||||
|
||||
TextOptions options = new(font);
|
||||
|
||||
FontRectangle bounds = TextMeasurer.MeasureBounds("È", options);
|
||||
FontRectangle size = TextMeasurer.MeasureSize("È", options);
|
||||
FontRectangle advance = TextMeasurer.MeasureAdvance("È", options);
|
||||
|
||||
Font fontWoff = new FontCollection().Add(TestFonts.PermanentMarkerRegularWoff2File).CreateFont(142);
|
||||
|
||||
TextOptions optionsWoff = new(fontWoff);
|
||||
|
||||
FontRectangle boundsWoff = TextMeasurer.MeasureBounds("È", optionsWoff);
|
||||
FontRectangle sizeWoff = TextMeasurer.MeasureSize("È", optionsWoff);
|
||||
FontRectangle advanceWoff = TextMeasurer.MeasureAdvance("È", optionsWoff);
|
||||
|
||||
Assert.Equal(bounds, boundsWoff);
|
||||
Assert.Equal(size, sizeWoff);
|
||||
Assert.Equal(advance, advanceWoff);
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче