Display unicode from basic macro (Solved)

I have a macro (simplified version below-edited, thanks rautamiekka) to insert certain special characters into a writer document. The macro prompts for user input (an Ascii character) selects the required unicode character and inserts it in the document. Although it worked in the past, the in the latest version of LO (4.2.7) the prompt does not display the unicode characters properly. Any ideas why this is (not) happening?

    sub InsertSpecial
rem insert a special character from a menu
  DIM s$, s1$, s2$, oText As Object, oVCurs As Object

  oText = ThisComponent.Text
  oVCurs = ThisComponent.CurrentController.getViewCursor()

  s = "A ∀        B ∵       T ∴" & Chr$(10)
  s2 = InputBox(s,"Insert Special Character","A")
  If s2 = "" Then Exit Sub
  s1 = UCase(Left(s2,1))

  Select Case s1
    Case "A" : s1 = "∀"
    Case "B" : s1 = "∵"
    Case "T" : s1 = "∴"
  End Select
  oText.insertString(oVCurs, s1, False)
  oText.insertString(oVCurs, Mid(s2, 2), False)

end sub

4.2.7 is latest Still version, but the very newest is 4.4.0 RC1, and if you don’t count pre-releases, 4.3.3 is very newest, but 4.2.7 is definitely not newest.

As for your code, you have to add 4 spaces befeore each line, including empty lines, to have it considered a code.

Thanks Rautamiekka, I see that 4.3.3 is out. However, 4.2.7 is the latest version offered by Synaptic.

Yeah, cuz the Still branch equals stable. If you’re running Ubuntu or Ubuntu-based, you can use https://launchpad.net/~libreoffice/+archive/ubuntu/ppa. Whether it’ll work for Debian I can’t say, and I have no clue about other distros/package systems.

Problem persists in 4.3.4.

In what way do you trigger (call) the sub?

Does the promp (input box) show up properly, except the special characters?

Did you try to debug the sub (setting breakpoints or inserting output statements)?

I cannot test with every version, but can confirm that the sub works fine under Win 8.1 in PortableLibreOffice V4.3.3.

Thanks, Lupp, that is interesting that it works in your set-up. The sub is called from a keyboard shortcut in Writer under Ubuntu 14.04. Everything works correctly except the display of special characters in the input box. They display correctly in the listing. Debugging reveals that the string ‘s’ contains what it should contain. I’m not sure what else I can check.

It’s a pity that I don’t know enough about the handling of fonts by different types or layers of executables. This under Linux even more. But what you tell seems to point to the question: Has the basic code while being interpreted (executed) access to the font(s) containing the special characters and/or are the fonts used by basic correctly replaced if necessary?

What do you get in the Writer document if make your selection blind?

Yes, your question expresses my deductions, but more clearly. However, I do not know how to proceed, and I don’t understand ‘make your selection blind’. Help me with that, please.

No secret meanings. The input box is showing, I think, everything except the special characters (SCs). You will see an “A”, e.g. as a hint that hitting the A-key will produce one of the SCs (which itself i not displayed). Hitting now that key actually is, what I called “blind selection”. Is anything inserted into your text after hitting “A” (e.g.)?

LibreOffice is dedicated to be and to exclusively use free software, this including the fonts. So should be Ubuntu. The default font for Writer under windows is ‘Liberation Serif’, for Calc ‘Liberation Sans’. Both these fonts do not contain the three special symbols of your example (U+2200, U+2235, U+2234). On my windows system there is active a replacement mechanism which is obviously working sufficiently: Look for an Ubuntu specialist to get advice best.

Speaking of Free Software fonts, maybe http://www.dafont.com/theme.php?cat=501&fpp=100&af=on&a=on&sort=alpha&l[]=10&l[]=1 will help you. I can’t tell for sure whether those support everything, but it’s a start.

Lupp, my friend, I think you may have the answer. However, Liberation Sans in Writer itself under Ubuntu has all the characters, and Liberation Serif most (including the inverted ‘A’). So presumably the default font is something else.
Where did you find the default font under Windows? Any idea what is the deafult font in Ubuntu? Can one change it?
Moreover, the SC’s appear correctly in the listing of the macro, so basic must use different fonts in the listing and display.

If there are just a few (mathematical) symbols you need you might also consider installing the ‘Compose Special Characters’ extension and configure some shortcuts instead of programming a Sub using an input box.

This will, of course, not be the appropriate way if you want to deliver the feature contained in your documents.

Thanks, Lupp. I use shortcut keys quite a lot on the Ubuntu desktop and for accents in Writer. But rather a lot of special characters (20+) in my original Writer macro. My memory not sufficient for so many shortcuts!

Thanks to Lupp, I have an answer.
In the macro edit screen, I selected Tools-Options-LO-Fonts, and in the lower half of the window changed the font from ‘Automatic’ to ‘Liberation Mono.’
I don’t know what the default font was, but the symbols are all displaying correctly now.

OK. This is not working again. Now I don’t know how I made it work. Aargh!

This time, I think I have solved it. From any LO screen, select Tools-Options-LO-View and uncheck “Use system font for user interface.”