Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Core Text on macOS, remove runtime dependencies for linux release binary #18

Closed
wants to merge 15 commits into from

Conversation

7sDream
Copy link
Owner

@7sDream 7sDream commented Jul 7, 2020

I hope issue #10 will disappear after finish this.

This PR need two part of work:

1. For macOS: Use Core Text API to match and render font

Due to servo-fontconfig-sys do not compile static library itselfs on macOS.(servo/libfontconfig#53)

TODO List for this goal:

  • Extract font match logic as a trait
  • fontconfig impl the matcher trait
  • Make a core-text font match api wrapper
  • Adjust Font/Family struct to use Cow to support owned string type
  • fontconfig matcher trait impl update as Font/Family struct has changed
  • core-text api impl the matcher trait
  • diff with fontconfig result
  • figure out how to get font face index(opend question in Apple Developer Forum)
  • Extract font render logic as a trait
  • FreeType impl render trait
  • Make a core-text font render api wrapper
  • core-text api impl the render trait

Now the list font and preview in browser should works fine in macOS without fontconfig installed.

freetype-sys support static link, so manual install from brew is not required too.

The only missing part is: freetype needs index to load font from file, but Core Text API seems do not provide this attribute, So tui preview not work for now.

Maybe we need adjust render logic to support Core Text Glyph Renderer too...... I'm not sure for now. I will pause work on this part before I figure out how to get index or have enough time to do a renderer refactor.

2020/05/31: I decide to use Core Text as Render Engine in macOS.
I just recently made a abstract layer to support different engines and adapted FreeType to this layer, it works well. I think I will implement Core Text Render logic in next weekends.

2. For Linux: Static link to fontconfig and freetype

TODO List for this goal:

Now this goal works well by using deps' git master version and my patched fork.

But I think we need to wait for upstream merge/publish those change and upgrade deps to that official version to make a stable release.

@7sDream 7sDream force-pushed the feature/use-core-text-on-macOS branch from c154018 to b2d966b Compare July 26, 2020 09:14
@7sDream
Copy link
Owner Author

7sDream commented Nov 11, 2023

Close due to I decide to use pure Rust, multi-platform crates to deal with font loading and renderering, not stick in platform-native solution.

@7sDream 7sDream closed this Nov 11, 2023
@7sDream 7sDream mentioned this pull request Nov 12, 2023
19 tasks
@7sDream 7sDream deleted the feature/use-core-text-on-macOS branch November 14, 2023 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant