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

Make font weights more aligned with Xcode #245

Closed
wants to merge 3 commits into from

Conversation

danielzsh
Copy link

Description

This PR makes CodeEdit's font weights align more with XCode's.

Before:
image

After:
image

XCode:
image

This PR notably lacks support for specifying customs weights in the theme file, and instead hardcodes weights based on symbol for the time being; I'm open to either working on supporting theme file now or after this PR is merged :)

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

@austincondiff austincondiff changed the title Make font weights more aligned with XCode Make font weights more aligned with Xcode May 3, 2024
FastestMolasses
FastestMolasses previously approved these changes May 3, 2024
Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I’m wrong, but are you putting a stroke around each character to get a thicker weight? Xcode uses a medium weight. CodeEdit currently uses a normal weight. I think changing our default weight to medium is what probably needs to happen instead.

@danielzsh
Copy link
Author

danielzsh commented May 3, 2024

I believe the default weight is already medium, as seen here: https://github.com/CodeEditApp/CodeEdit/blob/0f87857497d24f65b6310634251f63d8e3935c3d/CodeEdit/Features/Settings/Pages/TextEditingSettings/Models/TextEditingSettings.swift#L185

But XCode goes even further as to highlight keywords and certain other tokens with bold (notice in the XCode screenshot the variable names have the same weight as CodeEdit's current font).

Would also appreciate input on what the strokeWidth we use should be; I was tampering between -3.0 and -4.0 (which I believe is what Xcode uses), and couldn't really decide which one looked better.

@danielzsh
Copy link
Author

Actually, -5.0 might be closer:
image

@danielzsh
Copy link
Author

@austincondiff bump?

@austincondiff
Copy link
Collaborator

I don’t think this is the correct way to change the font weight. @thecoolwinter do you have any ideas how we might better do this?

@thecoolwinter
Copy link
Collaborator

thecoolwinter commented May 13, 2024

Instead of increasing weight via stroke width, using font weights directly would be more robust for various fonts. Different fonts use different stroke widths for each weight, so using a constant stroke width modifier for certain captures might result in slightly different typeface than expected.

I hate to ask you to throw away this work, but I'd also rather it be tied to the theme rather than hardcoded to specific captures. That'll be more flexible for users, and fits in with existing theme code. It should just require a change to the theme struct and ThemeAttributesProviding protocol. Adding a small struct for each capture in the theme that contains both a color and font weight. That'll help support future attributes if needed too, like underlining.

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.

🐞 Font a bit blurrier in CodeEdit than Xcode?
4 participants