[Solved] Default Font

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
hika
Posts: 39
Joined: Tue Apr 17, 2018 12:53 am

[Solved] Default Font

Post 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
Last edited by hika on Tue May 08, 2018 6:17 pm, edited 3 times in total.
openoffice 4.1.2/4.1.4 and libreoffice 5.4.4.2/5.4.5.1 both on Gentoo and on Windows
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Default Font

Post 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)?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: Default Font

Post 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)
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
hika
Posts: 39
Joined: Tue Apr 17, 2018 12:53 am

Re: Default Font

Post 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.
openoffice 4.1.2/4.1.4 and libreoffice 5.4.4.2/5.4.5.1 both on Gentoo and on Windows
hika
Posts: 39
Joined: Tue Apr 17, 2018 12:53 am

Re: Default Font

Post 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
openoffice 4.1.2/4.1.4 and libreoffice 5.4.4.2/5.4.5.1 both on Gentoo and on Windows
hika
Posts: 39
Joined: Tue Apr 17, 2018 12:53 am

Re: Default Font

Post 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
openoffice 4.1.2/4.1.4 and libreoffice 5.4.4.2/5.4.5.1 both on Gentoo and on Windows
Post Reply