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 Enso Font #7516

Merged
merged 18 commits into from
Aug 17, 2023
Merged

Use Enso Font #7516

merged 18 commits into from
Aug 17, 2023

Conversation

kazcw
Copy link
Contributor

@kazcw kazcw commented Aug 8, 2023

Pull Request Description

Use the new Enso Font; also change the anti-aliasing logic to be based on device pixel ratio, rather than platform. This will improve the clarity of font rendering on Windows/Linux machines with high pixel densities.

Design reference:

image

Tested on various combinations of DPR/platform:

OS X, devicePixelRatio = 2 (should look similar to how we were already rendering mplus1 on OS X):
Screenshot 2023-08-07 at 5 46 11 PM

Windows, devicePixelRatio = 1.25 (should look similar to how we were already rendering mplus1 on this platform/DPR):
image

Linux, devicePixelRatio = 1 (should look similar to how we were already rendering mplus1 on this platform/DPR):
image

Important Notes

Style changes:

  • Use the Enso Font for code in Rust, replacing the DejaVu fonts.
  • Use the Enso Font in HTML: code in documentation, and error visualizations.
  • Change SpanWidgets from Bold to Extra Bold, to match the design.

Implementation improvements:

  • The new font download is cached (and Github-authenticated); this should eliminate a "rate limit" build failure I've
    encountered in the past.
  • Clean up DocSection HTML rendering a bit.
  • Remove a CSS file that seems to have been superseded.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

Moving toward the new design:
- New font replaces DejaVu Sans Mono.
- Change bolded SpanWidgets to extra-bolded.
Use new font in:
- Docs
- Error visualizations
@kazcw kazcw self-assigned this Aug 8, 2023
@kazcw kazcw added the CI: No changelog needed Do not require a changelog entry for this PR. label Aug 8, 2023
Copy link
Contributor

@somebody1234 somebody1234 left a comment

Choose a reason for hiding this comment

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

on the JS side it's mostly things being deleted, so no added code that needs to be reviewed

app/ide-desktop/lib/content/src/index.html Show resolved Hide resolved
#[derive(Debug)]
struct FixedContentUrl<D> {
url: Url,
filename: Box<Path>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why Box<Path> is used everywhere instead of PathBuf?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a more specific type. PathBuf supports all the operations of Box<Path>, and additional operations. The additional operations offered by PathBuf are not appropriate for this value--it's the file part of a path, so e.g. it makes no sense to append anything to it. This is not a very important distinction in this case, but it also doesn't cost us anything here to be precise.

lib/rust/enso-font/src/lib.rs Outdated Show resolved Hide resolved
lib/rust/enso-font/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@farmaazon farmaazon left a comment

Choose a reason for hiding this comment

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

The code is heavily duplicated. I think we could just extend ensogl-text-font-family crate and use it in the build script and enso-font crate.

app/ide-desktop/lib/content/src/index.html Show resolved Hide resolved
Comment on lines 18 to 20
/// The `filename` parameter may be any path-safe string; it will only be seen when inspecting the
/// cache.
pub async fn get_file_from_cache_or_download(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean that filename will be used just as Cache key? This is how I've understood this, but I'm not 100% sure.

And what "path-safe" means? I deduce from the code below, that it rather should not be an absolute path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clarified the docs.

build/build/src/ide/web/fonts.rs Outdated Show resolved Hide resolved
@@ -0,0 +1,11 @@
[package]
name = "enso-enso-font"
Copy link
Contributor

Choose a reason for hiding this comment

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

This name is a bit amusing :) why not just "enso-font"?

Copy link
Contributor Author

@kazcw kazcw Aug 9, 2023

Choose a reason for hiding this comment

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

Yeah, it sounds funny, but it is to avoid confusion: Since we prefix everything with enso-, enso-font would be what we call the Enso package for fonts (and actually after refactoring, that name is used). This is the Enso package for the Enso font.

lib/rust/ensogl/component/text/src/font/embedded/build.rs Outdated Show resolved Hide resolved
lib/rust/enso-font/src/lib.rs Outdated Show resolved Hide resolved
lib/rust/enso-font/src/lib.rs Outdated Show resolved Hide resolved
@kazcw kazcw linked an issue Aug 9, 2023 that may be closed by this pull request
@kazcw kazcw marked this pull request as draft August 9, 2023 16:07
@kazcw kazcw marked this pull request as ready for review August 9, 2023 16:07
@farmaazon farmaazon self-requested a review August 10, 2023 07:06
build/build/src/ide/web/download.rs Outdated Show resolved Hide resolved
@@ -0,0 +1,105 @@
//! Support for downloading files.
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this effectively duplicates build/ci_utils/src/cache/download.rs, including the use-case of using octocrab to download the file?
I think these should be unified and be part of ide_ci::cache::download.

The Downloader is neat. I don't like the assumption of contents being constant by URL (as my use-case is a counterexample) — but perhaps the Key type could be provided by the Downloader as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I missed that module. Rewrote it to use the existing API.

build/build/src/ide/web/fonts.rs Outdated Show resolved Hide resolved
build/build/src/ide/web/download.rs Outdated Show resolved Hide resolved
build/build/src/ide/web/fonts.rs Outdated Show resolved Hide resolved
lib/rust/enso-font/src/lib.rs Show resolved Hide resolved
@kazcw kazcw marked this pull request as draft August 10, 2023 20:02
@kazcw kazcw marked this pull request as ready for review August 10, 2023 20:02
@vitvakatu
Copy link
Contributor

QA Report: 🔴

Everything seems fine except for one issue. The cursor position does not match the actual place where the new characters are added/removed. This is not present on the most recent develop.

Kapture.2023-08-14.at.11.52.26.mp4

@enso-bot
Copy link

enso-bot bot commented Aug 16, 2023

Keziah Wesley reports a new STANDUP for yesterday (2023-08-14):

Progress: Debugging an issue with cursor/selection logic. The PR does not change this logic, but I think the bug is exposed by using a non-monospace font for editable text. It should be finished by 2023-08-16.

Next Day: Next day I will be working on the #7516 task. Find the bug.

@enso-bot
Copy link

enso-bot bot commented Aug 17, 2023

Keziah Wesley reports a new STANDUP for yesterday (2023-08-15):

Progress: Debugging wrong glyph counts. It should be finished by 2023-08-16.

Next Day: Next day I will be working on the #7516 task. Find the bug.

@kazcw kazcw added the CI: Ready to merge This PR is eligible for automatic merge label Aug 17, 2023
@vitvakatu vitvakatu removed the CI: Ready to merge This PR is eligible for automatic merge label Aug 17, 2023
@vitvakatu
Copy link
Contributor

The PR did not pass QA, so it can't be merged yet. I will check now.

@vitvakatu vitvakatu added the CI: Ready to merge This PR is eligible for automatic merge label Aug 17, 2023
@vitvakatu
Copy link
Contributor

QA passed 📗

@mergify mergify bot merged commit 1dfdee5 into develop Aug 17, 2023
24 checks passed
@mergify mergify bot deleted the wip/kw/enso-font branch August 17, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use new Enso font
6 participants