fontsize

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - User interface
Introduced first in SolidGeometry 5.1, Creation date: 2021-10-12, Last change: 2025-09-15

sets the font size of all text to a specified figure



See Also: SGfigureeval , SGfigurepapermode , papermode , textadjust2gca

Example Illustration

 missing image of fontsize(FS,ds)

Syntax

h=fontsize([FS,ds])

Input Parameter

FS: default is 16pt on a printout
ds: if true, the font size is adjusted based on the figure size

Output Parameter

h: handle to all text

Examples






Copyright 2021-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, `fontsize`, is designed to adjust the font size of all text elements in a MATLAB figure. It is part of the SolidGeometry library and was introduced in version 5.1.

Input Parameters

Output Results

Algorithm Steps

  1. Retrieve the font size (`FS`) from the input parameters, defaulting to 16 if not provided.
  2. Retrieve the dynamic size flag (`ds`) from the input parameters, defaulting to true if not provided.
  3. Get the current figure's position using `get(gcf,'Position')`.
  4. If `ds` is true, adjust `FS` by scaling it with the figure's height (`sc(4)`) relative to a base height of 640.
  5. Initialize an empty array `h` to store handles to text elements.
  6. If the number of output arguments is less than 2, proceed to adjust font sizes:
  7. Store the handles of these elements in `h`.
Algorithm explaination created using ChatGPT on 2025-08-19 01:20. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21