Skip to content

Replace freetype-sys with freetype-rs #3369

Open

Description

@jdm

freetype-rs looks so much more pleasant to use. We could get rid of lots of unsafe blocks in the font-related code in gfx, and probably fix some of those lurking crashes that appear every few months.

Activity

  1. added
    B-interesting-project
    I-safety
    on Sep 16, 2014
  2. jdm commented on Sep 19, 2014

    @jdm
    MemberAuthor

    Note: NCSU students might be working on this, so please contact me before commencing any work to avoid overlap.

  3. added
    E-less-complex
    on Apr 1, 2015
  4. kmcallister commented on Apr 1, 2015

    @kmcallister
    Contributor

    They submitted #4215, which switches to Piston's freetype-sys but not to the high level bindings.

    This issue is up for grabs again and would be a great start for an eager contributor from the Rust community!

  5. schuster commented on May 4, 2015

    @schuster
    Contributor

    I'd like to work on this. What's the best way to test that this works, once I've made the change?

  6. jdm commented on May 4, 2015

    @jdm
    MemberAuthor

    @schuster Likely just test some sites that use various fonts and check that they look the same before and after.

  7. cuzbog commented on Jul 17, 2015

    @cuzbog
    Contributor

    Any news on this?

  8. jdm commented on Jul 17, 2015

    @jdm
    MemberAuthor

    @boghison You're welcome to start working on it if you'd like.

  9. schuster commented on Jul 17, 2015

    @schuster
    Contributor

    @boghison I'm working on it my free time now and then, but I haven't had nearly as much time as I'd like. Feel free to start on it, although I'm still going to work on it as well (as a Rust learning exercise for myself as much as anything else).

    It should be pretty simple if you already know Rust; I'm just slowed down by learning about lifetimes, lifetime parameters, and other parts of the ownership model as I go through it all.

  10. cuzbog commented on Jul 17, 2015

    @cuzbog
    Contributor

    Ok, I am gonna give this a try :)

  11. cuzbog commented on Jul 17, 2015

    @cuzbog
    Contributor

    @jdm What I am worried about is FreeTypeLibraryHandle and its use, because AFAIU this relies on the raw implementation and therefore has to be entirely replaced. Thoughts?

  12. jdm commented on Jul 17, 2015

    @jdm
    MemberAuthor

    @boghison I think it's fine to leave raw API when necessary - you can replace the FT_Library with the Library type (https://github.com/PistonDevelopers/freetype-rs/blob/master/src/library.rs#L34), but it looks like our use of FT_Memory and the UserPtr should stay, since we do special things with them.

  13. added
    C-assigned
    on Jul 17, 2015
  14. 28 remaining items

  15. cuzbog commented on Jul 22, 2015

    @cuzbog
    Contributor

    My code changes are here. Until the freetype-sys issue is solved, it's in limbo.

  16. removed
    C-assigned
    on Aug 9, 2015
  17. removed
    E-less-complex
    on Sep 14, 2015
  18. nox commented on Jul 3, 2016

    @nox
    Contributor

    What do we need to do here? WR depends on our freetype crate and I want to remove that.

  19. jdm commented on Jul 3, 2016

    @jdm
    MemberAuthor

    We need to switch all of the packages that depend on freetype-sys away from it.

  20. nox commented on Jul 3, 2016

    @nox
    Contributor

    @jdm I'm not sure I parse what you mean. Do you mean we should switch all the packages that depend on servo/rust-freetype away from it?

  21. jdm commented on Jul 3, 2016

    @jdm
    MemberAuthor

    Yes, that's what I meant.

  22. changed the title [-]Replace rust-freetype with freetype-rs[/-] [+]Replace `freetype-sys` with `freetype-rs`[/+] on Dec 14, 2024
  23. mrobinson commented on Dec 14, 2024

    @mrobinson
    Member

    The rust-freetype dependency was removed in #32318 and we now depend on freetype-sys directly.

  24. IsaacMarovitz commented on Feb 26, 2025

    @IsaacMarovitz
    Contributor

    @jdm Has cosmic-text been considered?

  25. jdm commented on Feb 26, 2025

    @jdm
    MemberAuthor

    No. I don't have more than a cursory knowledge of cosmic-text, but I have the impression that it does a lot more than we need?

  26. mrobinson commented on Feb 26, 2025

    @mrobinson
    Member

    I think we a much tighter integration with platform font APIs and OpenType than a library like cosmic-text allows.

  27. mrobinson commented on Feb 26, 2025

    @mrobinson
    Member

    We plan to use skrifa more and more as time goes on. We should be able to use it to replace a lot of platform-dependent parsing code.

  28. Keerti707 commented on Mar 2, 2026

    @Keerti707
    Contributor

    Hi!!
    I would like to work on this issue if its available,please assign it to me.

    My approach will be to find all direct uses of {freetype-sys}, replace them with a safe wrapper crate,make sure everything still works as expected, and then remove the direct dependency.
    Please let me know if there is a preferred wrapper crate I should use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gfx/uncategorizedB-interesting-projectI-safety

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions