moudey / Shell

Powerful context menu manager for Windows File Explorer
https://nilesoft.org
MIT License
3.23k stars 109 forks source link

Glyphs in Strings (and the Font) #480

Open andreaxhearts opened 1 month ago

andreaxhearts commented 1 month ago

Either case, you replace the blank part in the unicode hex with that of the glyph you want to use. IDs can be found on the website^3 (built-in glyphs, not Segoe font), Character Map, or by using a custom script: Icon Explorer.[^4]


//custom theme
theme
{
...

// image.glyph='Segoe Fluent Icons'
// font name for default glyph

...

font
{
size = 14
name = "Segoe UI Variable Text"
italic = 0
}

I tried changing the font for the theme, and that's where my confusion about glyphs came from. What's being used when in a string? Setting image.glyph to something in the theme didn't change this missing icon:

"Press SHIFT key to run Command Prompt as administrator". Tool tip message in Nilesoft's Terminal menu - with the missing "admin" icon being replaced with the square representing an undefined symbol.

What's the default font? Does Segoe UI Symbol usually get used here?

Would it be possible to be able to customize this font?

example : terminal.nss:

menu(type='*' where=(sel.count or wnd.is_taskbar or wnd.is_edit) title=title.terminal sep=sep.top image=icon.run_with_powershell)
{
    $tip_run_admin=["\xE1A7 Press SHIFT key to run " + this.title + " as administrator", tip.warning, 1.0]
    $has_admin=key.shift() or key.rbutton()

    item(title=title.command_prompt tip=tip_run_admin admin=has_admin image cmd-prompt=`/K TITLE Command Prompt &ver& PUSHD "@sel.dir"`)
    item(title=title.windows_powershell admin=has_admin tip=tip_run_admin image cmd-ps=`-noexit -command Set-Location -Path '@sel.dir'`)
    item(where=package.exists("WindowsTerminal") title=title.Windows_Terminal tip=tip_run_admin admin=has_admin image='@package.path("WindowsTerminal")\WindowsTerminal.exe' cmd="wt.exe" arg=`-d "@sel.path\."`)
}

example :

item(type="*" title="Icon Test \xE2B4" image=image.fluent(\uE171, 10) cmd=msg("\uE28C A Test..."))

[^2]: Discord: glyph in string

[^4]: Icon Explorer

ghost commented 1 month ago

Additionally, you can put an icon in a string by just putting \u____. For example, how one is used in terminal.nss for a tooltip, or how they can be used in a title,2 There doesn't seem to be a way to define a source (or color).

Re: There doesn't seem to be a way to define a source The glyphs inside double quotes are sourced from the current display font. This evident from the 2nd reference you have given. I had used Shell's own font as base and was able to utilize it's glyphs inside double quotes. After setting it as display font of course. Re: (or color) Possibly because they are not interpreted as images by shell but as literal Unicode characters.

I tried changing the font for the theme, and that's where my confusion about glyphs came from. What's being used when in a string?

I have no idea why the glyph is not showing up. It's being displayed correctly at my end. image

To confirm if its an issue with Shell at your end you can try installing shell.ttf from here. Set it as the display font and use some glyphs in titles or tips to see if they show up or not.

moudey commented 1 month ago
// image.glyph='Segoe Fluent Icons'
// font name for default glyph

This option exists, but it is not currently activated. I will try to activate it in the next update

ghost commented 1 month ago

I was wondering if this is related to your issue at all? Can you give an update whether the glyphs are being rendered properly or not after installing the fonts manually?

andreaxhearts commented 1 month ago

I have those four fonts installed. I was only missing Marlett and Back Button Icons before. No change there. I installed the Nilesoft Shell font you linked to as well. . . .

font
{
size = 14
name = "Segoe UI"
italic = 0
// good
}
font
{
size = 14
name = "Shell"
italic = 0
// good
}

Using any other fonts for the theme other than the above ones give missing glyphs for me.

I noticed I didn't include any operating system details in the op. I'm running Windows 10 Home x64, version 22H2 (build 19045.4651). Someone can test on Win 10 and see if it's normal or not for them too. I'm having computer trouble atm, otherwise I'd try a Win 11 vm on the nvme ssd I'd normally use.