Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[submodule "externals/harfbuzz"]
path = externals/harfbuzz
url = https://github.com/harfbuzz/harfbuzz.git
branch = 2.5.3
branch = 2.6.1
[submodule "docs"]
path = docs
url = https://github.com/mono/SkiaSharp-API-docs
Expand Down
10 changes: 5 additions & 5 deletions VERSIONS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ANGLE.WindowsStore release 2.1.13
mdoc.targets release 5.7.4.9
mdoc release 5.7.4.9
harfbuzz release 2.5.3
harfbuzz release 2.6.1
skia release m68
xunit release 2.4.1
xunit.runner.console release 2.4.1
Expand All @@ -18,15 +18,15 @@ AtkSharp release 3.22.24.37

# native sonames
libSkiaSharp soname 68.1.0
HarfBuzz soname 0.20503.0
HarfBuzz soname 0.20601.0

# SkiaSharp.dll
SkiaSharp assembly 1.68.0.0
SkiaSharp file 1.68.1.0

# HarfBuzzSharp.dll
HarfBuzzSharp assembly 1.0.0.0
HarfBuzzSharp file 2.5.3.0
HarfBuzzSharp file 2.6.1.0

# nuget versions
SkiaSharp nuget 1.68.1
Expand All @@ -41,5 +41,5 @@ SkiaSharp.Views.WPF nuget 1.68.1
SkiaSharp.Views.Forms nuget 1.68.1
SkiaSharp.Views.Forms.WPF nuget 1.68.1
SkiaSharp.HarfBuzz nuget 1.68.1
HarfBuzzSharp nuget 2.5.3
HarfBuzzSharp.NativeAssets.Linux nuget 2.5.3
HarfBuzzSharp nuget 2.6.1
HarfBuzzSharp.NativeAssets.Linux nuget 2.6.1
18 changes: 18 additions & 0 deletions binding/HarfBuzzSharp.Shared/Buffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ public unsafe void AddUtf32 (ReadOnlySpan<uint> text, int itemOffset, int itemLe
}
}

public void AddUtf32 (ReadOnlySpan<int> text) => AddUtf32 (text, 0, -1);

public unsafe void AddUtf32 (ReadOnlySpan<int> text, int itemOffset, int itemLength)
{
fixed (int* integers = text) {
AddUtf32 ((IntPtr)integers, text.Length, itemOffset, itemLength);
}
}

public void AddUtf32 (IntPtr text, int textLength) =>
AddUtf32 (text, textLength, 0, -1);

Expand All @@ -204,6 +213,15 @@ public unsafe void AddCodepoints (ReadOnlySpan<uint> text, int itemOffset, int i
}
}

public void AddCodepoints (ReadOnlySpan<int> text) => AddCodepoints (text, 0, -1);

public unsafe void AddCodepoints (ReadOnlySpan<int> text, int itemOffset, int itemLength)
{
fixed (int* codepoints = text) {
AddCodepoints ((IntPtr)codepoints, text.Length, itemOffset, itemLength);
}
}

public void AddCodepoints (IntPtr text, int textLength) => AddCodepoints (text, textLength, 0, -1);

public void AddCodepoints (IntPtr text, int textLength, int itemOffset, int itemLength)
Expand Down
54 changes: 54 additions & 0 deletions binding/HarfBuzzSharp.Shared/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,58 @@ public enum UnicodeGeneralCategory
ParagraphSeparator, // Zp
SpaceSeparator // Zs
}

public enum OpenTypeMetricsTag : uint
{
CapHeight = 1668311156,
HorizontalAscender = 1751216995,
HorizontalClippingAscent = 1751346273,
HorizontalClippingDescent = 1751346276,
HorizontalCaretOffset = 1751347046,
HorizontalCaretRun = 1751347822,
HorizontalCaretRise = 1751347827,
HorizontalDescender = 1751413603,
HorizontalLineGap = 1751934832,
SubScriptEmXOffset = 1935833199,
SubScriptEmXSize = 1935833203,
SubScriptEmYOffset = 1935833455,
SubScriptEmYSize = 1935833459,
SuperScriptEmXOffset = 1936750703,
SuperScriptEmXSize = 1936750707,
SuperScriptEmYOffset = 1936750959,
SuperScriptEmYSize = 1936750963,
StrikeoutOffset = 1937011311,
StrikeoutSize = 1937011315,
UnderlineOffset = 1970168943,
UnderlineSize = 1970168947,
VerticalAscender = 1986098019,
VerticalCaretOffset = 1986228070,
VerticalCaretRun = 1986228846,
VerticalCaretRise = 1986228851,
VerticalDescender = 1986294627,
VerticalLineGap = 1986815856,
XHeight = 2020108148,
}

public readonly struct OpenTypeMetrics
{
private readonly IntPtr font;

public OpenTypeMetrics (IntPtr font)
{
this.font = font;
}

public bool TryGetPosition (OpenTypeMetricsTag metricsTag, out int position) =>
HarfBuzzApi.hb_ot_metrics_get_position (font, metricsTag, out position);

public float GetVariation (OpenTypeMetricsTag metricsTag) =>
HarfBuzzApi.hb_ot_metrics_get_variation (font, metricsTag);

public int GetXVariation (OpenTypeMetricsTag metricsTag) =>
HarfBuzzApi.hb_ot_metrics_get_x_variation (font, metricsTag);

public int GetYVariation (OpenTypeMetricsTag metricsTag) =>
HarfBuzzApi.hb_ot_metrics_get_y_variation (font, metricsTag);
}
}
21 changes: 20 additions & 1 deletion binding/HarfBuzzSharp.Shared/Font.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public Font (Face face)
throw new ArgumentNullException (nameof (face));

Handle = HarfBuzzApi.hb_font_create (face.Handle);
OpenTypeMetrics = new OpenTypeMetrics (Handle);
}

public Font (Font parent)
Expand All @@ -29,10 +30,13 @@ public Font (Font parent)

Parent = parent;
Handle = HarfBuzzApi.hb_font_create_sub_font (parent.Handle);
OpenTypeMetrics = new OpenTypeMetrics (Handle);
}

public Font Parent { get; }

public OpenTypeMetrics OpenTypeMetrics { get; }

public string[] SupportedShapers =>
PtrToStringArray (HarfBuzzApi.hb_shape_list_shapers ()).ToArray ();

Expand Down Expand Up @@ -63,12 +67,21 @@ public bool TryGetHorizontalFontExtents (out FontExtents extents) =>
public bool TryGetVerticalFontExtents (out FontExtents extents) =>
HarfBuzzApi.hb_font_get_v_extents (Handle, out extents);

public bool TryGetNominalGlyph (int unicode, out uint glyph) =>
TryGetNominalGlyph ((uint)unicode, out glyph);

public bool TryGetNominalGlyph (uint unicode, out uint glyph) =>
HarfBuzzApi.hb_font_get_nominal_glyph (Handle, unicode, out glyph);

public bool TryGetVariationGlyph (int unicode, out uint glyph) =>
TryGetVariationGlyph (unicode, 0, out glyph);

public bool TryGetVariationGlyph (uint unicode, out uint glyph) =>
HarfBuzzApi.hb_font_get_variation_glyph (Handle, unicode, 0, out glyph);

public bool TryGetVariationGlyph (int unicode, uint variationSelector, out uint glyph) =>
TryGetVariationGlyph ((uint)unicode, variationSelector, out glyph);

public bool TryGetVariationGlyph (uint unicode, uint variationSelector, out uint glyph) =>
HarfBuzzApi.hb_font_get_variation_glyph (Handle, unicode, variationSelector, out glyph);

Expand Down Expand Up @@ -149,11 +162,17 @@ public unsafe bool TryGetGlyphName (uint glyph, out string name)
public bool TryGetGlyphFromName (string name, out uint glyph) =>
HarfBuzzApi.hb_font_get_glyph_from_name (Handle, name, name.Length, out glyph);

public bool TryGetGlyph (int unicode, out uint glyph) =>
TryGetGlyph ((uint)unicode, 0, out glyph);

public bool TryGetGlyph (uint unicode, out uint glyph) =>
TryGetGlyph (unicode, 0, out glyph);

public bool TryGetGlyph (int unicode, uint variationSelector, out uint glyph) =>
TryGetGlyph ((uint)unicode, variationSelector, out glyph);

public bool TryGetGlyph (uint unicode, uint variationSelector, out uint glyph) =>
HarfBuzzApi.hb_font_get_glyph (Handle, unicode, variationSelector, out glyph);
HarfBuzzApi.hb_font_get_glyph(Handle, unicode, variationSelector, out glyph);

public FontExtents GetFontExtentsForDirection (Direction direction)
{
Expand Down
9 changes: 9 additions & 0 deletions binding/HarfBuzzSharp.Shared/HarfBuzzApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ internal unsafe class HarfBuzzApi

[DllImport (HARFBUZZ, CallingConvention = CallingConvention.Cdecl)]
public extern static void hb_ot_font_set_funcs (hb_font_t font);
[DllImport (HARFBUZZ, CallingConvention = CallingConvention.Cdecl)]
public extern static hb_bool_t hb_ot_metrics_get_position (hb_font_t font, OpenTypeMetricsTag metrics_tag, out hb_position_t position /* OUT. May be NULL. */);
[DllImport (HARFBUZZ, CallingConvention = CallingConvention.Cdecl)]
public extern static float hb_ot_metrics_get_variation (hb_font_t font, OpenTypeMetricsTag metrics_tag);
[DllImport (HARFBUZZ, CallingConvention = CallingConvention.Cdecl)]
public extern static hb_position_t hb_ot_metrics_get_x_variation (hb_font_t font, OpenTypeMetricsTag metrics_tag);
[DllImport (HARFBUZZ, CallingConvention = CallingConvention.Cdecl)]
public extern static hb_position_t hb_ot_metrics_get_y_variation (hb_font_t font, OpenTypeMetricsTag metrics_tag);


// hb_buffer_t

Expand Down
2 changes: 1 addition & 1 deletion externals/harfbuzz
Submodule harfbuzz updated 181 files
4 changes: 2 additions & 2 deletions native-builds/libHarfBuzzSharp_android/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
#define PACKAGE_NAME "HarfBuzz"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "HarfBuzz 2.5.3"
#define PACKAGE_STRING "HarfBuzz 2.6.1"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "harfbuzz"
Expand All @@ -147,7 +147,7 @@
#define PACKAGE_URL "http://harfbuzz.org/"

/* Define to the version of this package. */
#define PACKAGE_VERSION "2.5.3"
#define PACKAGE_VERSION "2.6.1"

/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
Expand Down
2 changes: 2 additions & 0 deletions native-builds/libHarfBuzzSharp_android/jni/HarfBuzzSharp.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ LOCAL_SRC_FILES := ../../../externals/harfbuzz/src/hb-aat-layout.cc
../../../externals/harfbuzz/src/hb-ot-layout.cc \
../../../externals/harfbuzz/src/hb-ot-map.cc \
../../../externals/harfbuzz/src/hb-ot-math.cc \
../../../externals/harfbuzz/src/hb-ot-meta.cc \
../../../externals/harfbuzz/src/hb-ot-metrics.cc \
../../../externals/harfbuzz/src/hb-ot-name.cc \
../../../externals/harfbuzz/src/hb-ot-shape-complex-arabic.cc \
../../../externals/harfbuzz/src/hb-ot-shape-complex-default.cc \
Expand Down
4 changes: 2 additions & 2 deletions native-builds/libHarfBuzzSharp_ios/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
#define PACKAGE_NAME "HarfBuzz"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "HarfBuzz 2.5.3"
#define PACKAGE_STRING "HarfBuzz 2.6.1"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "harfbuzz"
Expand All @@ -171,7 +171,7 @@
#define PACKAGE_URL "http://harfbuzz.org/"

/* Define to the version of this package. */
#define PACKAGE_VERSION "2.5.3"
#define PACKAGE_VERSION "2.6.1"

/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
34C930C821FA5A77002D729C /* hb-warning.cc in Sources */ = {isa = PBXBuildFile; fileRef = 34C9309B21FA5A77002D729C /* hb-warning.cc */; };
34C930C921FA5A77002D729C /* hb-fallback-shape.cc in Sources */ = {isa = PBXBuildFile; fileRef = 34C9309C21FA5A77002D729C /* hb-fallback-shape.cc */; };
34C930CA21FA5A77002D729C /* hb-ot-var.cc in Sources */ = {isa = PBXBuildFile; fileRef = 34C9309D21FA5A77002D729C /* hb-ot-var.cc */; };
34F68011233ED0F70091C30D /* hb-ot-meta.cc in Sources */ = {isa = PBXBuildFile; fileRef = 34F6800B233ED0F70091C30D /* hb-ot-meta.cc */; };
34F68012233ED0F70091C30D /* hb-ot-metrics.cc in Sources */ = {isa = PBXBuildFile; fileRef = 34F68010233ED0F70091C30D /* hb-ot-metrics.cc */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -124,6 +126,12 @@
34C9309C21FA5A77002D729C /* hb-fallback-shape.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "hb-fallback-shape.cc"; path = "../../externals/harfbuzz/src/hb-fallback-shape.cc"; sourceTree = "<group>"; };
34C9309D21FA5A77002D729C /* hb-ot-var.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "hb-ot-var.cc"; path = "../../externals/harfbuzz/src/hb-ot-var.cc"; sourceTree = "<group>"; };
34D723421EB385E900E6210E /* libHarfBuzzSharp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libHarfBuzzSharp.a; sourceTree = BUILT_PRODUCTS_DIR; };
34F6800B233ED0F70091C30D /* hb-ot-meta.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "hb-ot-meta.cc"; path = "../../externals/harfbuzz/src/hb-ot-meta.cc"; sourceTree = "<group>"; };
34F6800C233ED0F70091C30D /* hb-ot-metrics.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = "hb-ot-metrics.hh"; path = "../../externals/harfbuzz/src/hb-ot-metrics.hh"; sourceTree = "<group>"; };
34F6800D233ED0F70091C30D /* hb-ot-meta-table.hh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = "hb-ot-meta-table.hh"; path = "../../externals/harfbuzz/src/hb-ot-meta-table.hh"; sourceTree = "<group>"; };
34F6800E233ED0F70091C30D /* hb-ot-meta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "hb-ot-meta.h"; path = "../../externals/harfbuzz/src/hb-ot-meta.h"; sourceTree = "<group>"; };
34F6800F233ED0F70091C30D /* hb-ot-metrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "hb-ot-metrics.h"; path = "../../externals/harfbuzz/src/hb-ot-metrics.h"; sourceTree = "<group>"; };
34F68010233ED0F70091C30D /* hb-ot-metrics.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "hb-ot-metrics.cc"; path = "../../externals/harfbuzz/src/hb-ot-metrics.cc"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -158,6 +166,12 @@
34C9308621FA5A76002D729C /* hb-ot-layout.cc */,
34C9307521FA5A76002D729C /* hb-ot-map.cc */,
34C9309321FA5A77002D729C /* hb-ot-math.cc */,
34F6800D233ED0F70091C30D /* hb-ot-meta-table.hh */,
34F6800B233ED0F70091C30D /* hb-ot-meta.cc */,
34F6800E233ED0F70091C30D /* hb-ot-meta.h */,
34F68010233ED0F70091C30D /* hb-ot-metrics.cc */,
34F6800F233ED0F70091C30D /* hb-ot-metrics.h */,
34F6800C233ED0F70091C30D /* hb-ot-metrics.hh */,
34C9308F21FA5A77002D729C /* hb-ot-name.cc */,
34C9308C21FA5A76002D729C /* hb-ot-shape-complex-arabic.cc */,
34C9308021FA5A76002D729C /* hb-ot-shape-complex-default.cc */,
Expand Down Expand Up @@ -287,6 +301,7 @@
34C930B521FA5A77002D729C /* hb-ot-shape-complex-indic.cc in Sources */,
34C930C221FA5A77002D729C /* hb-font.cc in Sources */,
34B817C522BD8F6F00508F73 /* hb-ucd.cc in Sources */,
34F68012233ED0F70091C30D /* hb-ot-metrics.cc in Sources */,
34C930C321FA5A77002D729C /* hb-set.cc in Sources */,
34C930A021FA5A77002D729C /* hb-ot-shape-complex-indic-table.cc in Sources */,
34C930AA21FA5A77002D729C /* hb-ot-cff2-table.cc in Sources */,
Expand All @@ -297,6 +312,7 @@
34B817C822BD8F6F00508F73 /* hb-subset-cff1.cc in Sources */,
34C930B321FA5A77002D729C /* hb-ot-layout.cc in Sources */,
34C930A821FA5A77002D729C /* hb-ot-shape-complex-hebrew.cc in Sources */,
34F68011233ED0F70091C30D /* hb-ot-meta.cc in Sources */,
34C930AF21FA5A77002D729C /* hb-shaper.cc in Sources */,
34C930A721FA5A77002D729C /* hb-ot-font.cc in Sources */,
34B817C622BD8F6F00508F73 /* hb-subset.cc in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions native-builds/libHarfBuzzSharp_linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ src = \
${src_root}/hb-ot-layout.cc \
${src_root}/hb-ot-map.cc \
${src_root}/hb-ot-math.cc \
${src_root}/hb-ot-meta.cc \
${src_root}/hb-ot-metrics.cc \
${src_root}/hb-ot-name.cc \
${src_root}/hb-ot-shape-complex-arabic.cc \
${src_root}/hb-ot-shape-complex-default.cc \
Expand Down
4 changes: 2 additions & 2 deletions native-builds/libHarfBuzzSharp_linux/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
#define PACKAGE_NAME "HarfBuzz"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "HarfBuzz 2.5.3"
#define PACKAGE_STRING "HarfBuzz 2.6.1"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "harfbuzz"
Expand All @@ -171,7 +171,7 @@
#define PACKAGE_URL "http://harfbuzz.org/"

/* Define to the version of this package. */
#define PACKAGE_VERSION "2.5.3"
#define PACKAGE_VERSION "2.6.1"

/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
Expand Down
4 changes: 2 additions & 2 deletions native-builds/libHarfBuzzSharp_osx/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
#define PACKAGE_NAME "HarfBuzz"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "HarfBuzz 2.5.3"
#define PACKAGE_STRING "HarfBuzz 2.6.1"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "harfbuzz"
Expand All @@ -171,7 +171,7 @@
#define PACKAGE_URL "http://harfbuzz.org/"

/* Define to the version of this package. */
#define PACKAGE_VERSION "2.5.3"
#define PACKAGE_VERSION "2.6.1"

/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
Expand Down
Loading