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

Add Config setting to force "lame fonts" #3839

Closed
tznind opened this issue Nov 21, 2024 · 8 comments · Fixed by #3923
Closed

Add Config setting to force "lame fonts" #3839

tznind opened this issue Nov 21, 2024 · 8 comments · Fixed by #3923
Milestone

Comments

@tznind
Copy link
Collaborator

tznind commented Nov 21, 2024

@tznind - I'm trying to figure out why you're not getting the right glyphs for buttons.

With that font, I get:

image

Originally posted by @tig in #3831 (comment)

@tznind tznind changed the title @tznind - I'm trying to figure out why you're not getting the right glyphs for buttons. Default fonts in vs code older versions missing some tg glyphs Nov 21, 2024
@tznind tznind changed the title Default fonts in vs code older versions missing some tg glyphs Default fonts in vs studio older versions missing some tg glyphs Nov 21, 2024
@tznind
Copy link
Collaborator Author

tznind commented Nov 24, 2024

@tig these are the fonts that I have configured - I havent made any changes I think, so this should be the default fonts if you were to install Visual Studio Community Edition at the time I did (a few years ago now).

image

These are the missing font characters (tickbox, radio button, button corner etc)

image

@tig tig added this to the V2 Beta milestone Feb 25, 2025
@tig
Copy link
Collaborator

tig commented Feb 25, 2025

Windows ConHost is simply not capable of rendering correctly.

I suggest you switch to Windows Termianal. You can configure the default behavior in Windows Settings:

Image

@BDisp
Copy link
Collaborator

BDisp commented Feb 26, 2025

Or switch to "Let Windows decide" also works.

@tig tig changed the title Default fonts in vs studio older versions missing some tg glyphs Add Config setting to force "lame fonts" Feb 26, 2025
@tig
Copy link
Collaborator

tig commented Feb 26, 2025

Changed name of Issue to something actionable.

We already have the ability to override Glyphs via CM:

"Glyphs": {
    "File": "",
    "Folder": "",
    "HorizontalEllipsis": "",
    "VerticalFourDots": "",
    "CheckStateChecked": "",
    "CheckStateUnChecked": "",
    "CheckStateNone": "",
    "Selected": "",
    "UnSelected": "",
    "RightArrow": "",
    "LeftArrow": "",
    "DownArrow": "",
    "UpArrow": "",
    "LeftDefaultIndicator": "",
    "RightDefaultIndicator": "",
    "LeftBracket": "",
    "RightBracket": "",
    "BlocksMeterSegment": "",
    "ContinuousMeterSegment": "",
    "Stipple": "",
    "Diamond": "",
    "Close": "",
    "Minimize": "",
    "Maximize": "",
    "Dot": "",
    "DottedSquare": "",
    "BlackCircle": "",
    "Expand": "+",
    "Collapse": "-",
    "IdenticalTo": "",
    "Move": "",
    "SizeHorizontal": "",
    "SizeVertical": "",
    "SizeTopLeft": "",
    "SizeTopRight": "",
    "SizeBottomRight": "",
    "SizeBottomLeft": "",
    "Apple": "\uD83C\uDF4E",
    "AppleBMP": "",
    "HLine": "",
    "VLine": "",
    "HLineDbl": "",
    "VLineDbl": "",
    "HLineHvDa2": "",
    "VLineHvDa3": "",
    "HLineHvDa3": "",
    "HLineHvDa4": "",
    "VLineHvDa2": "",
    "VLineHvDa4": "",
    "HLineDa2": "",
    "VLineDa3": "",
    "HLineDa3": "",
    "HLineDa4": "",
    "VLineDa2": "",
    "VLineDa4": "",
    "HLineHv": "",
    "VLineHv": "",
    "HalfLeftLine": "",
    "HalfTopLine": "",
    "HalfRightLine": "",
    "HalfBottomLine": "",
    "HalfLeftLineHv": "",
    "HalfTopLineHv": "",
    "HalfRightLineHv": "",
    "HalfBottomLineLt": "",
    "RightSideLineLtHv": "",
    "BottomSideLineLtHv": "",
    "LeftSideLineHvLt": "",
    "TopSideLineHvLt": "",
    "ULCorner": "",
    "ULCornerDbl": "",
    "ULCornerR": "",
    "ULCornerHv": "",
    "ULCornerHvLt": "",
    "ULCornerLtHv": "",
    "ULCornerDblSingle": "",
    "ULCornerSingleDbl": "",
    "LLCorner": "",
    "LLCornerHv": "",
    "LLCornerHvLt": "",
    "LLCornerLtHv": "",
    "LLCornerDbl": "",
    "LLCornerSingleDbl": "",
    "LLCornerDblSingle": "",
    "LLCornerR": "",
    "URCorner": "",
    "URCornerDbl": "",
    "URCornerR": "",
    "URCornerHv": "",
    "URCornerHvLt": "",
    "URCornerLtHv": "",
    "URCornerDblSingle": "",
    "URCornerSingleDbl": "",
    "LRCorner": "",
    "LRCornerDbl": "",
    "LRCornerR": "",
    "LRCornerHv": "",
    "LRCornerDblSingle": "",
    "LRCornerSingleDbl": "",
    "LRCornerLtHv": "",
    "LRCornerHvLt": "",
    "LeftTee": "",
    "LeftTeeDblH": "",
    "LeftTeeDblV": "",
    "LeftTeeDbl": "",
    "LeftTeeHvH": "",
    "LeftTeeHvV": "",
    "LeftTeeHvDblH": "",
    "RightTee": "",
    "RightTeeDblH": "",
    "RightTeeDblV": "",
    "RightTeeDbl": "",
    "RightTeeHvH": "",
    "RightTeeHvV": "",
    "RightTeeHvDblH": "",
    "TopTee": "",
    "TopTeeDblH": "",
    "TopTeeDblV": "",
    "TopTeeDbl": "",
    "TopTeeHvH": "",
    "TopTeeHvV": "",
    "TopTeeHvDblH": "",
    "BottomTee": "",
    "BottomTeeDblH": "",
    "BottomTeeDblV": "",
    "BottomTeeDbl": "",
    "BottomTeeHvH": "",
    "BottomTeeHvV": "",
    "BottomTeeHvDblH": "",
    "Cross": "",
    "CrossDblH": "",
    "CrossDblV": "",
    "CrossDbl": "",
    "CrossHvH": "",
    "CrossHvV": "",
    "CrossHv": "",
    "ShadowVerticalStart": "",
    "ShadowVertical": "",
    "ShadowHorizontalStart": "",
    "ShadowHorizontal": "",
    "ShadowHorizontalEnd": ""
  },

But it'd be nice to have a single setting like;

"Application.ForceLameFonts": true,

Extra credit if we can detect the need (I've already thot a bunch about this... it's really hard to get right).

@tznind
Copy link
Collaborator Author

tznind commented Feb 26, 2025

I think having named defaults would be nice.

E.g. GlyphSet then you can override specific runes if wanted in the glyphs bit

So just would be

{
  "GlyphSet": "Lame",
  "Glyphs": {
    "Expand": "➕",
    "Collapse": "➖",
    "Close": "✘",
    "Move": "◊"
  }
}

@tig
Copy link
Collaborator

tig commented Feb 26, 2025

Just found out that CM is broken for overriding Glyphs.

Working on a fix now.

@tig
Copy link
Collaborator

tig commented Feb 26, 2025

now with

This works:

Image

@tig
Copy link
Collaborator

tig commented Feb 26, 2025

I think it's best to address this PR by leveraging themes.

In #3923, I'm going to move the Glyphs out of SettingsScope into ThemeScope.

That will fix this issue too; you can do this:

{
    "$schema": "https://gui-cs.github.io/Terminal.GuiV2Docs/schemas/tui-config-schema.json",
    "Theme" : "LameGlyphs",
    "Themes": [
        {
            "With LameGlyphs": {
                "Glyphs.LeftBracket": "[",
                "Glyphs.RightBracket": "]",
                "Glyphs.CheckStateChecked": "",
        }
    ]
}

@tig tig closed this as completed in #3923 Feb 26, 2025
@tig tig closed this as completed in f3697a9 Feb 26, 2025
tig added a commit that referenced this issue Feb 28, 2025
* Moved scripts

* testing versions

* Rune extensions micro-optimizations (#3910)

* Add benchmarks for potentially optimizable RuneExtensions

* Add new RuneExtensions.DecodeSurrogatePair benchmark implementation

Avoids intermediate heap array allocations which is especially nice when the rune is not surrogate pair because then array heap allocations are completely avoided.

* Enable nullable reference types in RuneExtensions

* Make RuneExtensions.MaxUnicodeCodePoint readonly

Makes sure no one can accidentally change the value. Ideally would be const value.

* Optimize RuneExtensions.DecodeSurrogatePair

* Remove duplicate Rune.GetUnicodeCategory call

* Add new RuneExtensions.IsSurrogatePair benchmark implementation

Avoids intermediate heap allocations by using stack allocated buffer.

* Optimize RuneExtensions.IsSurrogatePair

* Add RuneExtensions.GetEncodingLength tests

* Optimize RuneExtensions.GetEncodingLength

* Optimize RuneExtensions.Encode

* Print encoding name in benchmark results

* Rename variable to better match return description

* Add RuneExtensions.EncodeSurrogatePair benchmark

---------

Co-authored-by: Tig <tig@users.noreply.github.com>

* Reduce func allocations (#3919)

* Replace Region.Contains LINQ lambdas with foreach loop

Removes the lambda func allocations caused by captured outer variables.

* Replace LineCanvas.Has LINQ lambda with foreach loop

* Fix LineCanvas.GetMap intersects array nullability

It should be enough to add null-forgiving operator somewhere in the LINQ query to make the final result non-null. No need to shove the nullability further down the line to complicate things. :)

* Replace LineCanvas.All LINQ lambda with foreach loop

* Replace Region.Intersect LINQ lambdas and list allocation with foreach loop and rented array

* Use stackalloc buffer in Region.Intersect when max 8 rectangles

* Fix LineCanvas.GetCellMap intersects array nullability

* Remove leftover LineCanvas.GetRuneForIntersects null-conditional operators

* Remove leftover IntersectionRuneResolver.GetRuneForIntersects null-conditional operators

* PosAlign.CalculateMinDimension: calculate sum during loop

No need to first put the dimensions in a list and then sum the list when you can just add to sum while looping through dimensions.

* PosAlign.CalculateMinDimension: Remove intermediate list and related filter func allocation

* TextFormatter.GetRuneWidth: Remove intermediate list and related sum func allocation

* ReadOnlySpan refactor preparation for GetCellMap rewrite

* LineCanvas.GetCellMap: Reuse intersection list outside nested loops

GetCellMap would not benefit much from array pool because IntersectionDefinition is not struct. This  change eliminates majority of the rest of Func<,> allocations. As a bonus IntersectionDefinition[] allocations dropped nicely.

* Refactor local method UseRounded

* Wrap too long list of method parameters

* Region: Consistent location for #nullable enable

---------

Co-authored-by: Tig <tig@users.noreply.github.com>

* Fixes #3918 and #3913 - `Accepting` behavior (#3921)

* Fixed #3905, #3918

* Tweaked Generic

* Label code cleanup

* Clean up.

* Clean up.

* Clean up2.

* Fixes #3839, #3922 - CM Glyphs not working (#3923)

* fixed

* Moved Glyphs to ThemeScope

* Removed test code

* Fixed nav (#3926)

* Fixes #3881. PositionCursor broke with recent ConsoleDriver changes. (#3927)

* Reduce IntersectionType[] allocations (#3924)

* Eliminate LineCanvas.Has params array allocation

Inline ReadOnlySpan arguments do not incur heap allocation compared to regular arrays.

* Allocate once LineCanvas.Exactly corner intersection arrays

---------

Co-authored-by: Tig <tig@users.noreply.github.com>

* API doc updates (#3928)

---------

Co-authored-by: Tonttu <15074459+TheTonttu@users.noreply.github.com>
Co-authored-by: BDisp <bd.bdisp@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants