harfbuzzjs icon indicating copy to clipboard operation
harfbuzzjs copied to clipboard

Expose constants/enums?

Open papandreou opened this issue 2 years ago • 4 comments

Hi,

It feels a bit dirty to hardcode constants like this, especially if they're subject to change in new major versions:

  • https://github.com/papandreou/subset-font/blob/3c06f95ddd417038a854b707cc7a678abf0541bc/index.js#L44
  • https://github.com/papandreou/subset-font/blob/3c06f95ddd417038a854b707cc7a678abf0541bc/index.js#L54
  • https://github.com/papandreou/subset-font/blob/3c06f95ddd417038a854b707cc7a678abf0541bc/index.js#L62

Is there any way those somehow be included with harfbuzzjs?

papandreou avatar Jan 09 '23 07:01 papandreou

I have had this problem with every WebAssembly project I've worked on. It does look like Emscripten has a way of exposing C++ enums and constants to JS, which could be used now that this project uses Emscripten.

chearon avatar Jan 09 '23 19:01 chearon

HarfBuzz is ABI and API stable, these values don't change across releases, even major ones.

khaledhosny avatar Jan 17 '23 06:01 khaledhosny

Okay, that makes me feel slightly less worried about hardcoding them. Still, I think it would be worth it to expose them as a pure DX/discoverability thing?

papandreou avatar Jan 17 '23 10:01 papandreou

Sure, if someone wants to do it.

khaledhosny avatar Jan 17 '23 11:01 khaledhosny