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

Linux: Try a CosmicText based Text System #7539

Merged
merged 19 commits into from
Feb 9, 2024

Conversation

h3mosphere
Copy link
Contributor

This is a rebase of @gabydds text_system updates. with some small cleanups.

Currently cannot test this as build is not working in linux. Im just putting it up here before I forget about it.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 8, 2024
@h3mosphere h3mosphere changed the title WIP: linux Text system cleanup Linux: WIP Text system cleanup Feb 8, 2024
@h3mosphere
Copy link
Contributor Author

Updated to main. Hopefully good to go.

@h3mosphere
Copy link
Contributor Author

Depends on #7555

@mikayla-maki mikayla-maki mentioned this pull request Feb 8, 2024
12 tasks
@gabydd
Copy link
Contributor

gabydd commented Feb 8, 2024

Did #7555 actually fix the rendering for you when I merged it and master too my branch with input it only half rendered and wouldn't expect input hopefully that was just a bad merge

@mikayla-maki mikayla-maki marked this pull request as draft February 8, 2024 22:31
@mikayla-maki mikayla-maki force-pushed the text-system-cleanup-5 branch 2 times, most recently from 1f95804 to 43db72d Compare February 8, 2024 22:47
@ForLoveOfCats
Copy link
Contributor

Does this need to pull in swash directly? It looks like it only uses the re-exports provided by Cosmic Text?

@gabydd
Copy link
Contributor

gabydd commented Feb 9, 2024

Doesn't need swash directly, that was just a historical artifact of how I was doing metrics conversion at one point

@h3mosphere
Copy link
Contributor Author

h3mosphere commented Feb 9, 2024

Hey,

I cleaned this up a little for inclusion @kvark 's branch, as per discord discussion, but then it landed in main. It's raw, just really what @gabydd came to after an inspired hacking session. It gets zed to the point of running, a minimal baseline with which to hack further.

I probably should have continued on with the blade branch, and cleaned this code up, but got busy trying to get zed to work with main.

@gabydd
Copy link
Contributor

gabydd commented Feb 9, 2024

No worries, of the top of my head here is a little Todo list:

What needs to be done:

  • figure out why the scroll track is extra long(check against mac cause maybe this is just the regular behavior)
  • figure out why the seperator between the gutter and editor disapears
  • font loading
    • look at getting system font fallback to work, hopefully can do this with font-db if not maybe use font-kit or look what they do
    • figure out if we actually need load_family/should change how we query from font-db, right now when first querying for a font id we almost always fallback to creating a new one because the font given by font id is not in the map
    • test if font-loading is slow, seems to take a bit of time but maybe that is something else
  • handle subpixel variant in rasterize glyph and raster bounds
  • I would love some more eyes on render_line, I don't think we need to use cosmic-texts Buffer here because we already do caching(we are double caching glyph rasterization actually both gpui and cosmic text have a cache), but its definetly possible I am not interfacing with cosmic text properly and I did get a crash at one point but wasn't able to reproduce it
  • optionally double check against font-kit that we are giving the correct metrics

What has been done:

  • get a font id that corresponds to cosmic text font for a font query
  • get usable metrics using a fonts swash representation, and bounds
  • rasterize a glyph using swash
  • render a line using cosmic-text
  • text renders in the editor in what seems to be the right spot and looks pretty good in my opinion

@mikayla-maki mikayla-maki changed the title Linux: WIP Text system cleanup Linux: WIP CosmicText Text System Feb 9, 2024
@mikayla-maki mikayla-maki marked this pull request as ready for review February 9, 2024 06:42
@mikayla-maki
Copy link
Contributor

With this PR, we can now render the hello world example!

Screenshot_from_2024-02-08_22-43-31

@mikayla-maki mikayla-maki changed the title Linux: WIP CosmicText Text System Linux: CosmicText Text System Feb 9, 2024
@mikayla-maki
Copy link
Contributor

What needs to be done:

Thank you for the comprehensive list! I think we can leave these for PRs as we go :)

@mikayla-maki mikayla-maki changed the title Linux: CosmicText Text System Linux: CosmicText based Text System Feb 9, 2024
@mikayla-maki mikayla-maki merged commit 67d280b into zed-industries:main Feb 9, 2024
8 checks passed
@mikayla-maki mikayla-maki changed the title Linux: CosmicText based Text System Linux: Try a CosmicText based Text System Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants