[Scilab-users] How to know which is the system's font?

classic Classic list List threaded Threaded
8 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] How to know which is the system's font?

Dear all,

For some display in the console, for which a monospaced font is required, i need to know the name of the system font. Indeed, when in the preferences the console's font is set to the Desktop font, and when the Desktop font is set to the system's font, the system's font is the console's one.

But i have no idea how to query the name of this font.
I have tried some property names with system_getproperty(), without success.

fonts=xlfont('AVAILABLE_FONTS') returns all fonts available on the system, but does not indicate which is the system's default one.

Finally, i have found nothing interesting out of
--> unix_w set  // and then getenv()

Any idea is welcome.
Best regards

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
ol.bond ol.bond
Reply | Threaded
Open this post in threaded view
|

Re: How to know which is the system's font?

Dear Samuel,

You may try to use buil in interpreter of Tcl/Tk.

Try the following instruction: TCL_EvalStr("set s [font actual systemfont]")



--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: How to know which is the system's font?

Le 29/10/2019 à 02:22, ol.bond a écrit :
> Dear Samuel,
>
> You may try to use buil in interpreter of Tcl/Tk.
>
> Try the following instruction: TCL_EvalStr("set s [font actual systemfont]")

--> TCL_EvalStr("set s [font actual systemfont]")
  ans  =
  -family Arial -size 10 -weight normal -slant roman -underline 0
-overstrike 0

Great! It's not a solution portable to MacOS, but it already helps for
95% of users.
Thanks

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: How to know which is the system's font?

Le 29/10/2019 à 18:16, Samuel Gougeon a écrit :

> Le 29/10/2019 à 02:22, ol.bond a écrit :
>> Dear Samuel,
>>
>> You may try to use buil in interpreter of Tcl/Tk.
>>
>> Try the following instruction: TCL_EvalStr("set s [font actual
>> systemfont]")
>
> --> TCL_EvalStr("set s [font actual systemfont]")
>  ans  =
>  -family Arial -size 10 -weight normal -slant roman -underline 0
> -overstrike 0


After some tests, this answer does not look (always) reliable.
In NW and NWNI mode on Windows, it is possible to change at any time the
font used in the cmd.exe terminal homing the scilab session. This
immediately changes the rendering in the Scilab console.
But this does not change the TCL_EvalStr() answer, that is always
"Arial" on my system, even when actually setting "Consolas" or "Lucida
console" as the actual font.

In Scilab STD mode, i don't know how to check if Arial is actually the
system's font.

Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: How to know which is the system's font?

Hi Samuel, 

I am not sure whether the information from the preference tab are the one you need, if so, perhaps it could be retrieved by:

--> my_font = xmlGetValues("//fonts/body/fonts", ["font-face", "font-name", "font-size", "item", "latex", "system"])
my_font  =

!plain  Monospaced  13  Console  15  true  !


--> my_font = xmlGetValues("//fonts/body/fonts/item", ["desktop", "font-face", "font-name", "font-size", "name"])
my_font  =

!false  bold  Monospaced  16  Console   !
!                                       !
!false  bold  Monospaced  16  Scinotes  !



---- On Wed, 30 Oct 2019 03:44:21 +0800 Samuel Gougeon <[hidden email]> wrote ----

Le 29/10/2019 à 18:16, Samuel Gougeon a écrit :

> Le 29/10/2019 à 02:22, ol.bond a écrit :
>> Dear Samuel,
>>
>> You may try to use buil in interpreter of Tcl/Tk.
>>
>> Try the following instruction: TCL_EvalStr("set s [font actual
>> systemfont]")
>
> --> TCL_EvalStr("set s [font actual systemfont]")
>  ans  =
>  -family Arial -size 10 -weight normal -slant roman -underline 0
> -overstrike 0


After some tests, this answer does not look (always) reliable.
In NW and NWNI mode on Windows, it is possible to change at any time the
font used in the cmd.exe terminal homing the scilab session. This
immediately changes the rendering in the Scilab console.
But this does not change the TCL_EvalStr() answer, that is always
"Arial" on my system, even when actually setting "Consolas" or "Lucida
console" as the actual font.

In Scilab STD mode, i don't know how to check if Arial is actually the
system's font.

Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: How to know which is the system's font?

Hello Chin Luh,

Le 30/10/2019 à 03:17, Chin Luh Tan a écrit :
Hi Samuel, 

I am not sure whether the information from the preference tab are the one you need, if so, perhaps it could be retrieved by:

--> my_font = xmlGetValues("//fonts/body/fonts", ["font-face", "font-name", "font-size", "item", "latex", "system"])
my_font  =

!plain  Monospaced  13  Console  15  true  !

As far as i have understood (before opening this thread) how the  XConfiguration file works wrt the preferences settings, when "system" is true, the system font is used as Desktop Font, instead of the given one.
It's the case here, and  then the "plain Monospaced 13" is NOT used as Desktop font.
In the Preferences GUI, it is greyed when "Use system font" is checked:


But i don't know what the "item" stands for in this tag. It could set the preselected item Console|Scinotes of the "Custom font" section, but, after checking, it's not the case.

Next tags are used for the Custom font section. If their "desktop" attribute was set to "true", then for instance the Console font would be the Desktop one (defined in the previous section) instead of the given one (then greyed in the GUI).
All these settings are conditionally nested... Not really trivial.

At the end, the system font is still implicit. XConfiguration does not provides its name, and it does not have to, since this would be only for information, in read-only mode, that is meaningless in a settings file.

Regards
Samuel


--> my_font = xmlGetValues("//fonts/body/fonts/item", ["desktop", "font-face", "font-name", "font-size", "name"])
my_font  =

!false  bold  Monospaced  16  Console   !
!                                       !
!false  bold  Monospaced  16  Scinotes  !



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: How to know which is the system's font?

Le 31/10/2019 à 12:15, Samuel Gougeon a écrit :

Le 30/10/2019 à 03:17, Chin Luh Tan a écrit :
.../...
--> my_font = xmlGetValues("//fonts/body/fonts", ["font-face", "font-name", "font-size", "item", "latex", "system"])
my_font  =

!plain  Monospaced  13  Console  15  true  !
.../...
But i don't know what the "item" stands for in this tag. It could set the preselected item Console|Scinotes of the "Custom font" section, but, after checking, it's not the case.

Actually, it is the case (i might have forgotten doing something, saving the change?, when first testing): this attribute sets the preselected item of the Custom font section, when opening the GUI.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Chin Luh Tan Chin Luh Tan
Reply | Threaded
Open this post in threaded view
|

Re: How to know which is the system's font?

Hi Samuel, 

I see. In this case I am sorry for not able to help much, the last thing I could suggest (only for windows) is might be looking into the registry value. 

unix_w('REG QUERY HKCU\Console\ /s')

will shows the different shell fontface. so if you lauch the scilab-cli and change the font from the properties, you should be able to see the changes.

however, it only for windows, and it does not tell the font used in Wscilex.

rgds,
CL


---- On Thu, 31 Oct 2019 19:24:10 +0800 Samuel Gougeon <[hidden email]> wrote ----

Le 31/10/2019 à 12:15, Samuel Gougeon a écrit :

Le 30/10/2019 à 03:17, Chin Luh Tan a écrit :
.../...

--> my_font = xmlGetValues("//fonts/body/fonts", ["font-face", "font-name", "font-size", "item", "latex", "system"])
my_font  =

!plain  Monospaced  13  Console  15  true  !
.../...
But i don't know what the "item" stands for in this tag. It could set the preselected item Console|Scinotes of the "Custom font" section, but, after checking, it's not the case.

Actually, it is the case (i might have forgotten doing something, saving the change?, when first testing): this attribute sets the preselected item of the Custom font section, when opening the GUI.


_______________________________________________
users mailing list
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users