Page 1 of 1

[Solved] Default Font

PostPosted: Sat Apr 21, 2018 10:30 pm
by hika
I have bee trying to find the font specifics used as a default in dialogs. This so I can resize them on resizing a dialog.
If I check the FontDescriptor I get:
    Name =
    Height = 0
    Width = 0
    StyleName =
    Family = 0
    CharSet = 0
    Pitch = 0
    CharacterWidth = 0.0
    Weight = 0.0
    Slant = <Enum instance com.sun.star.awt.FontSlant ('DONTKNOW')>
    Underline = 4
    Strikeout = 3
    Orientation = 0.0
    Kerning = False
    WordLineMode = False
    Type = 0

I also checked the Peer and that gives even less.
If I go to the Editor it says "Default" in the propertylist and shows on opening the FontDialog "Liberation Sans 10".
Which also is the size I see being set in options. In Writer I see a default of "Liberation Serif 12" and probably there are more defaults that possibly a user can have changed. Maybe even through the operating system defaults.

So how and where can I access those defaults?

Hika

Re: Default Font

PostPosted: Sun Apr 22, 2018 9:13 am
by Zizi64
I have bee trying to find the font specifics used as a default in dialogs.


Do you mean the built-in dialogs (The Open dialog, Save dialog, Print dialog, etc... of the AOO/LO) or some user defined dialogs (created programatically)?

Re: Default Font

PostPosted: Sun Apr 22, 2018 9:41 am
by JeJe
My default for dialog and dialog control fonts is Segoe UI... that looks to be operating system dependent so you can get them through the Windows Api (SystemParametersInfo) but don't know about Linux.

The FontDescriptor returns those values unless you've changed them. It doesn't answer your query but you could just set all the values you want to be sure of yourself instead of relying on the default. You need to verify changes - if I set the font name to "blah blah" it will then return that as the new name (but of course not change the font to that non-existent one)

Re: Default Font

PostPosted: Sun Apr 22, 2018 11:06 am
by hika
Zizi64 wrote:Do you mean the built-in dialogs (The Open dialog, Save dialog, Print dialog, etc... of the AOO/LO) or some user defined dialogs (created programatically)?

Mostly the last, but I guess the first uses the same.

Re: Default Font

PostPosted: Sun Apr 22, 2018 11:14 am
by hika
In the mean time I have found I can just change the height through the model.FontHeight attribute, without knowing or touching any other font details in any of the models, so for now I will assume that that always defaults to 10. In a later stage, when I find where to extract the actual value, I can then replace that.

Hika

Re: Default Font

PostPosted: Fri Apr 27, 2018 1:44 am
by hika
I think I found it. They are supplied by the XStyleSettings interface which seems to be accessible through the 'StyleSettings' property in Windows and Dialogcontrols. However part of those settings like a buttoncolor are dependent on the 'NativeWidgetLook' property in the peer. I have to study it further.

Hika