I have got a solution for this. Earlier, I found answers for similar question saying change the units to normalized. I got confused with normal Units with FontUnits. GUI component has different units for every element. Do check the units for being normalized. I still wonder how to change every unit in the GUI to normalized using a command without manually checking the properties.
How to resize the text in GUI when the app is used in different screen resolution?
46 views (last 30 days)
Show older comments
I have developed a GUI using GUIDE and packaged that into an app to be used by different user with different screen resolution. I found that GUI figure is being resized according to the resolution but the text is not being scaled and being cut off. How to resize the text in a GUI when the resolution changes when packaged into an app? Any answers are welcomed. Thanks in advance.
5 Comments
Adam Danz
on 31 Jul 2018
As >1 person above has alluded, changing the FontUnits to normalized should fix the problem. 'FontUnits' is a text property that should be set from GUIDE or wherever you're creating the GUI.
Answers (1)
Adam Danz
on 1 Aug 2018
Edited: Adam Danz
on 5 Aug 2020
Option 1:
Open your GUI in GUIDE, right-click your edit box or text object to open the property inspector. Then change FontUnits to 'normalized'. You'll have to do this to all GUI components that have FontUnits property.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/192895/image.jpeg)
Option 2
Don't change the GUI in GUIDE. Instead, when you're opening your GUI have your code search for all objects with 'FontUnits' property and change the property to 'normalized'. To do this, open the GUI code and enter these 2 lines at the end of your "..._OpeningFcn()". If your GUI is named 'MyGUI',
function MyGUI_OpeningFcn()
...
txtHand = findall(handles.MyGUI, '-property', 'FontUnits');
set(txtHand, 'FontUnits', 'normalized')
end
The advantage of this method is that if you add more components to your GUI in the future, you won't need to remember to change their FontUnits. This is fast and changes all components automatically.
Demo
Here's option-2 applied to a fake demo-GUI in GUIDE.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/341818/image.gif)
10 Comments
CAM
on 7 Aug 2020
Edited: CAM
on 7 Aug 2020
My colleagues have different monitor resolutions (ex: 1920x1080) than me (2560x1440), hence the font size issues. I agree with you that there appears to be no simple way around it, other than using smaller fonts overall in the design (as I describe in my comments of July 22). I agree this is a minor issue, and we will just have to account for it in future apps.
Thank you so much for all of your help and the follow up discussions.
Adam Danz
on 8 Aug 2020
This thread from the MathWorks Support Team may be helpful, especially workaround #2.
Glad I could help (a little).
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!