Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

Thanks David
Mint on PC:
Screenshot from 2018-03-19 08-12-40.png
Screenshot from 2018-03-19 08-12-40.png (22.13 KiB) Viewed 1956 times
RPi:
Screenshot from 2018-03-19 08-11-53.png
Screenshot from 2018-03-19 08-11-53.png (23.66 KiB) Viewed 1956 times
Could this be relevant?
Last edited by philjynx on Mon Mar 19, 2018 10:45 am, edited 1 time in total.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

Do you have the image labels reversed? My virtualbox Mint seems to have 3.18, and my (real) debian stretch 3.22.

Anyway, they use different gtk+ versions so that explains the spam. As doublemax has said, the 'font' sample will help show if that's relevant to your real problem (though it could be other system things too e.g. your DE/WM).
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

I've corrected the labels!
Dunno what " e.g. your DE/WM" is...
Although the font sample works on the RPi, we're not looking at it's own menu fonts being changed i.e. the whole app.
I've had a gander at the code and it does loads of canvas painting (at least something I have familiarity with, since I wrote my own VCL for Delphi years ago as Borland's didn't do what I wanted - lots of canvas painting).

Wherever such things happen with a bog standard wxApp is, I imagine, a wxWidgets library thing - outside my control.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

Dunno what " e.g. your DE/WM" is...
Desktop Environment and Window Manager.
Although the font sample works on the RPi, we're not looking at its own menu fonts being changed i.e. the whole app.
I'm not sure I understand what you mean. In the 'font' sample menubar, does 'Font > Increase font size by 2 points' work for you? If so, that means your font system can't be completely broken.

I'm also not clear about what the real problem is. Whose idea is it to set a particular font/font-size anyway? Is it something you know you need, or just something that wxFormBuilder happens to do, that turns out wrong on the RPi? If the latter, what happens if you fix your wxFB options (or hack out the font settings by hand)?
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

I'm not sure I understand what you mean. In the 'font' sample menubar, does 'Font > Increase font size by 2 points' work for you? If so, that means your font system can't be completely broken.
The font sample app has a menu, with text in it. This text does not get changed in any way. Yes, the font sample app changes the fonts on the canvas that it has screeds of code for. From an application programmer's point of view, (I'm going to harp on about Delphi again, so look out!), you design your form on the screen - each control can either inherit all it's font properties from it's parent (form, panel, whatever), or on a control by control basis you can set any aspect of the font you desire, just by changing that item's properties - no need to write masses of stuff just to change the font, in fact no need to write any code at all for that.

It has to be said, that on the Mint PC, the same is true - (as per an earlier screenshot) I've only set the font once, in one place - namely the 'topframe', and all it's kids dutifully do what Ma (or Pa) - topframe says - no direct changes to the children's properties on my part.
On RPi, it's as though the kids are a little older and are ignoring their parent and doing what the kids next door are all doing!
Desktop Environment and Window Manager.
Desktop Environment and Window Manager - ok, that's what the abbreviations meant, but even so, I don't know what to do with those two expansions either! Call me thick, if you like....
Whose idea is it to set a particular font/font-size anyway? Is it something you know you need, or just something that wxFormBuilder happens to do, that turns out wrong on the RPi?
Mine and yes it is something I need, wxFormBuilder has put that font setting code in because I asked it to (i.e. I chose the font setting I wanted in the properties of that particular frame - which happens to be the top of the app i.e. the main one that appears when you launch it.

Here's why I need nice big fonts:
plank.jpg
This gizmo has a teensy 3.5 and RPi (amongst other things).
The Teensy handles the expression pedals, and the 24 RGB illuminated switches (optical switches) It also communicates via MIDI in three ways.
1 - DIN midi bi-directional communication with the GR55 synthesiser.
2 - USB midi bi-directional with laptop running Mobius Looping software.
3 - direct UART to UART link to the RPi
The RPi, acts as a bridge between the Teensy & the Katana amplifier via USB Midi, leaving 3 more USB ports free for other devices in the future.

In case anyone is wondering, the above is not my intention, all this gear designed and built by me, works reliably and as intended.

So, given that this MIDI controller lives on the floor, it needs big text in order for me to be able to read the screen!
The plan is for it to show Patch names from the synthesiser and the guitar amp and also (eventually) provide a configuration interface to change the settings for patches. At present, all the patches are hard coded into the Teensy and the RPi is simply providing that bridge I mentioned.

I doubt that wxFormBuilder is the culprit here, after all, it doesn't build the app, and that bit of code that it puts in because I wanted a bigger font

Code: Select all

this->SetFont( wxFont( 32, 70, 90, 90, false, wxEmptyString ) );
Is compiled and linked entirely outside wxFormBuilder's influence on both machines - just doesn't have the desired effect on the RPi.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by ONEEYEMAN »

Hi,
If the font sample does not work for you on the RPI, it means 2 things - either you don't have this specific font installed or something is preventing the font size change.

I presume you have a gdb and debug version of the wxWidgets built for Raspberry?
If yes - please try to run the font sample under gdb and do the "Font -> Inscrease the font by 2 pixels" menu. See if that code fails and why.
Most likely there is nothing wrong with your app.
Try to install different font on your Raspberry. I don't know if it has its own repository or how does it manages packages, but you should be able to find something either on the web or Raspberry forums.

All in all you just proved that this is a "missing font" or GTK+ problem issue - nothing is wrong with your app.

Thank you.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

This is what I said
The font sample app has a menu, with text in it. This text does not get changed in any way. Yes, the font sample app changes the fonts on the canvas that it has screeds of code for.
I did not say that the font sample doesn't work.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by ONEEYEMAN »

Ah, OK.
Sorry I misread your responce.

In any case look at the documentation on how the new font is created and try to correct the code wxFB is generating. See if that helps.
If it does - than we can go and file a report with wxFB about misconfiguring the font creation code.

Thank you.
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

Surely if wxFB code was wrong it would fail everywhere, not just on the RPi?
It works perfectly on Mint PC.
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by doublemax »

Please take the "minimal" sample and paste the following code at the end of the MyFrame constructor:

Code: Select all

wxPanel *panel = new wxPanel(this, wxID_ANY);

wxFont big_font(48, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL );
wxButton *button = new wxButton(panel, wxID_ANY, "Button", wxPoint(20,20), wxSize(300,70) );
button->SetFont( big_font );
Build and run on the RPi.

If you get a button with a big font, the problem is somewhere in your (or wxFB's) code.
If not, the problem lies somewhere in the DE/WM on the RPi system and it would require debugging to find out what's going on.
Use the source, Luke!
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by DavidHart »

Here's why I need nice big fonts:
Fair enough.

FWIW, adding this code:

Code: Select all

SetFont(GetFont().Scale(2));
to the frame ctor of the wx3.0.4 'text' sample works for all it's children too; that's on my non-RPi debian stretch. It doesn't affect the menubar; I don't know of a wx to do that. Presumably menus are less important for your use-case.

Alternatively, why not alter the RPi's system default font size?
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

DavidHart wrote:
Here's why I need nice big fonts:
Fair enough.

FWIW, adding this code:

Code: Select all

SetFont(GetFont().Scale(2));
to the frame ctor of the wx3.0.4 'text' sample works for all it's children too; that's on my non-RPi debian stretch. It doesn't affect the menubar; I don't know of a wx to do that. Presumably menus are less important for your use-case.

Alternatively, why not alter the RPi's system default font size?
Can't change the system font to 32! That would render everything except my app impossible to operate.
You're bang on the money regarding menus (if you mean in my App) - there won't be any menus, it's a full screen buttons only thing.
Thing is, it's ok for the configuration screens that the 'Settings' buttons lead to to be normal sized fonts since they are for fiddly setup which you wouldn't do standing up with the device on the floor.

I'll have a bash with that fragment you put (above).
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

doublemax wrote:Please take the "minimal" sample and paste the following code at the end of the MyFrame constructor:

Code: Select all

wxPanel *panel = new wxPanel(this, wxID_ANY);

wxFont big_font(48, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL );
wxButton *button = new wxButton(panel, wxID_ANY, "Button", wxPoint(20,20), wxSize(300,70) );
button->SetFont( big_font );
Build and run on the RPi.

If you get a button with a big font, the problem is somewhere in your (or wxFB's) code.
If not, the problem lies somewhere in the DE/WM on the RPi system and it would require debugging to find out what's going on.
I'll give that a go!
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

Well, it's promising, I tried the scaling thing. Problem is the text then doesn't fit the button :( and the button text is no longer vertically aligned with the label text and (fanfare) it makes no difference at all on the RPi!
philjynx
Earned some good credits
Earned some good credits
Posts: 137
Joined: Tue Mar 06, 2018 6:00 pm

Re: Font size shows as it should on Linnux Mint 64 bit but not on RPi Stretch

Post by philjynx »

Tried the BIG BUTTON here's how it went - big button, but font unaffected. :(
Screenshot from 2018-03-19 18-56-51.png
Screenshot from 2018-03-19 18-56-51.png (11.39 KiB) Viewed 1885 times
So, not a code issue, an RPi one.
Somewhat annoying.....

Debugging this issue on the RPi? I think that is way out of my league.
Post Reply