Page 1 of 1

[Solved] Default math font size?

Posted: Tue Mar 12, 2019 11:36 am
by Frie25
Can i a specify the default math font size?If yes then will be grateful if someone explains me how.Genuine replies are appreciated. :D

Re: Default math font size?

Posted: Tue Mar 12, 2019 12:24 pm
by Lupp
Menu path >Format>Font Size...
Genuine enough?

Re: Default math font size?

Posted: Wed Mar 13, 2019 2:19 pm
by Lupp
Assuming your answer was "no" because you wanted to set the .BaseFontHeight to a different value for all your newly created OLE objects containing a Math component, I took the opportunity to ask the generalised fundamental question concerning the topic in a different forum where I expeced a specific developer to expose his knowledge - and he did.
See https://ask.libreoffice.org/en/question ... ts-stored/.

Because the question was of some general interest for me (though not needing an answer since I mostly use some collecions of formulas as template surrogates) I also wrote a little macro usable to insert a formula into a Writer document setting the respective property at the same time. In fact I wouldn't recommend it for actual use in the current state because no precautions concerning the vertical alignment are taken so far. If interested you may study the code below. (Only tested with LibO V 6.2 and with AOO V 4.1.5)

Code: Select all

Sub insertFormulaSettingBaseFontHeight(Optional pBFH As Long)
REM You may also want to adjust the position. More insight needed.
REM You can simplify the the parameter handling for use in LibO.
If IsMissing(pBFH) Then
  bfh = 8 REM For testing!
Else
  bfh = pBFH
End If
doc0              = ThisComponent
doc0Frame         = doc0.CurrentController.Frame
dispatchHelper    = createUnoService("com.sun.star.frame.DispatchHelper")
dispatchHelper.executeDispatch(doc0Frame, ".uno:InsertObjectStarMath", "", 0, Array())
eos               = doc0.EmbeddedObjects
u                 = eos.Count - 1
eo                = eos.getByName(eos.ElementNames(u))
fo                = eo.Model
fo.BaseFontHeight = bfh
doc0Frame.activate
End Sub