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

Define bold, italics and mono fonts in editor log for print_rich() #62860

Merged

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jul 9, 2022

Follow-up to #60675.

This is also used by the number indicator for message grouping, as it uses a bold font.

Mono font does not actually turn proportional fonts into monospace. Instead, it's a more faint version of the regular font, intended to emulate the look of the "faint" ANSI escape code (and make [code] distinguishable from regular text).

The custom code font will be used to generate the bold/italic/mono variants if specified in the Editor Settings.

Testing project: test_print_rich.zip

Preview

The font used here is Recursive Mono Casual, but this also works with the default editor code font.

Editor log

2022-07-09_19 15 13

Editor log (custom font, Recursive Mono Casual Regular)

2022-07-09_19 16 31

Terminal (VS Code)

Uses ANSI escape codes instead of BBCode.

2022-07-09_19 14 55

This is also used by the number indicator for message grouping,
as it uses a bold font.

Mono font does not actually turn proportional fonts into monospace.
Instead, it's a more faint version of the regular font, intended
to emulate the look of the "faint" ANSI escape code (and make `[code]`
distinguishable from regular text).

The custom code font will be used to generate the bold/italic/mono
variants if specified in the Editor Settings.
@Calinou Calinou added this to the 4.0 milestone Jul 9, 2022
@bruvzg
Copy link
Member

bruvzg commented Jul 16, 2022

This specific use case asks for an extra font option to prevent advance changes when embolden is used (to have all font variants with the same fixed width), but it's probably an overkill.

@MarianoGnu
Copy link
Contributor

why make this workaround instead of use the same fonts created previously in this method, in example:

	Ref<FontFile> default_font_bold = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, false);
	Ref<FontFile> default_font_bold_msdf = load_internal_font(_font_NotoSans_Bold, _font_NotoSans_Bold_size, font_hinting, font_antialiased, true, font_subpixel_positioning, true);

@Calinou
Copy link
Member Author

Calinou commented Jul 16, 2022

why make this workaround instead of use the same fonts created previously in this method, in example:

These fonts are not fixed-width, so they're not consistent with the rest of the editor Output panel's font (which is a code font by default).

Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

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

Looks ok. It makes sense to add these fonts, to make print_rich() more complete.

@akien-mga akien-mga merged commit 3a5eac7 into godotengine:master Oct 4, 2022
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou deleted the editor-log-bold-italic-mono-fonts branch October 4, 2022 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants