uicontrol and annotation produce different fonts despite identical settings
Mostra commenti meno recenti
Hi,
Can anyone explain to me why the text in the following two figures is not identical?
% create long sample string
str = string(repmat('A ',1,128));
% create first figure, filling entire screen
fig1 = figure('Units','normalized','Position', [0 0 1 1],'Toolbar','none','Resize','off');
% create texbox within that figure via UI control
ctemp = uicontrol('Style','text','Units','normalized','Position', [0 0 1 1],...
'String',str,'FontName','Arial','FontSize',12,...
'FontWeight','normal','Visible','on','HorizontalAlignment','left');
% create second figure, again filling entire screen
fig2 = figure('Units','normalized','Position', [0 0 1 1],'Toolbar','none','Resize','off');
% create texbox within that figure via annotation
temp = annotation(fig2,'textbox',[0 0 1 1],'String',str,'EdgeColor','none', ...
'FontName','Arial','FontSize',12,'FontWeight','normal','Margin',0);
In particular, despite identical settings (Arial, 12pt, normal), the "annotation" command produces a larger/bolder font compared to the "uicontrol" command. On my screen, with a 1200x1920 resolution, the text in fig1 e.g. fits in one line, but has to be broken into two lines in fig2.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

