[HarfBuzz] Questions about using OpenType features in HarfBuzz

Ebrahim Byagowi ebraminio at gmail.com
Sat Jul 14 17:27:23 UTC 2018


Hi York.

The example provided there
<https://github.com/Robmaister/SharpFont.HarfBuzz/blob/master/Source/SharpFont.HarfBuzz.Example/Program.cs>
(which
I wrote
<https://github.com/Robmaister/SharpFont.HarfBuzz/commits/cf33e1aca4fce77d6554d234d1d0eb5e4447a750/SharpFont.HarfBuzz.Example/Program.cs>
years ago 😊) is really all what you need from harfbuzz most of the
cases, providing
a font, a string and its direction/language
<https://github.com/Robmaister/SharpFont.HarfBuzz/blob/cf33e1aca4fce77d6554d234d1d0eb5e4447a750/SharpFont.HarfBuzz.Example/Program.cs#L30-L35>
and calling harfbuzz to do all the hard works you've mentioned. But surely
HarfBuzz isn't enough for a complete text rendering stack so it is
suggested to not use harfbuzz directly everytime and use a higher level
libraries like Pango. There is a C# binding
<https://github.com/zwcloud/PangoSharp> for Pango and you can find more
which I guess you will find just easier to use.

If the features you've mentioned is not default enabled when you used
harfbuzz, you should however go a little deeper and help on completing the
binding to support related APIs.

"Which APIs are relevant?" most of the cases "hb_shape" is enough
(font.Shape(buf) in C# case). See this
<https://github.com/harfbuzz/harfbuzz-tutorial> also.

"Does the "direction"/"script"/"language" passed to HarfBuzz automatically
set some features?" yes.

On Sat, Jul 14, 2018 at 7:23 PM York Todd <tjysunset at outlook.com> wrote:

> Hello everyone,
>
> I'm working on a Han/Latin text layout & rendering program for personal
> use, in C# with FreeType as font provider. New to both HarfBuzz and
> typography, and the nasty CTL.
>
> The goal is to use various CJK/Latin related OpenType features in shaping,
> at user's (my) choice. To name a few, vert
> <https://helpx.adobe.com/typekit/using/open-type-syntax.html#vert>, pwid
> <https://helpx.adobe.com/typekit/using/open-type-syntax.html#pwid>, liga
> <https://helpx.adobe.com/typekit/using/open-type-syntax.html#liga> and
> onum <https://helpx.adobe.com/typekit/using/open-type-syntax.html#onum>.
>
> Sorry if it's already documented somewhere, but the docs at
> harfbuzz.github.io
> <https://harfbuzz.github.io/shaping-and-shape-plans.html> seems
> unfinished, google search returned nothing relevant, examples at GitHub
> wiki didn't even mention about OpenType features, even the C# binding
> <https://github.com/Robmaister/SharpFont.HarfBuzz> I'm using has a
> incomplete set of API (think that I can still pinvoke HarfBuzz dll as a
> workaround though) :/
>
> It would be nice if you could answer these (stupid?) questions:
>
>    - Does HarfBuzz simply take a list of OpenType features (or equivalent
>    arguments) and shape them into the glyphs, or do I have to manually apply
>    the features afterwards?
>    - Which APIs are relevant?
>    - Does the "direction"/"script"/"language" passed to HarfBuzz
>    automatically set some features?
>
> Thanks in advance!
>
> Todd
>
> --
> Todd J. York (pseudonym)
> zh-Hans-CN, en-US | UTC+08:00
> Sent from Thunderbird
>
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/harfbuzz
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20180714/82ad524a/attachment.html>


More information about the HarfBuzz mailing list