WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

global FontSize anpassen

 

hallo24

Gast


Beiträge: ---
Anmeldedatum: ---
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 17.04.2009, 11:33     Titel: global FontSize anpassen
  Antworten mit Zitat      
Hallo,
kann ich für ein ganzes m-file in allen figure-Umgebungen die Schriftgröße ändern?


outsider
Forum-Meister

Forum-Meister


Beiträge: 806
Anmeldedatum: 03.09.07
Wohnort: München
Version: R2012b
     Beitrag Verfasst am: 20.04.2009, 16:11     Titel:
  Antworten mit Zitat      
Schriftgröße für ein M-file in allen Figures ändern???
Verstehe nur Bahnhof... wie wärs, wenn Du etwas klarer beschreibst, was Du willst? Wir sind hier nicht in der Uri Geller Show ... Smile


MfG
Private Nachricht senden Benutzer-Profile anzeigen
 
josekamara
Forum-Meister

Forum-Meister


Beiträge: 529
Anmeldedatum: 26.04.08
Wohnort: München
Version: ---
     Beitrag Verfasst am: 20.04.2009, 16:25     Titel:
  Antworten mit Zitat      
Code:
function setfonts(hFig,SCALE)
%   SETFONTS Set the fontname and fontsizes used in the GUI.
%   SETFONTS(hFig,SCALE) sets the fonts of the figure hFig.  The
%   'Helvetica' font was chosen as the default for all text since
%   it resizes well.  To change the font or font sizes, change the
%   constants in the code for this function.
%
%   The SCALE parameter is a positive number used to SCALE the size
%   of the fonts in this file.  Using SCALE = 1, or leaving the argument
%   out, means the font size will be determined exactly by the constants
%   given in the code.  Using SCALE = 2 will double the font size.
%  
%   See also GETFONTSCALE

% Jordan Rosenthal, 04-Oct-1999

error(nargchk(1,2,nargin));         % Error check number of input arguments
if nargin == 1, SCALE = 1; end       % Let SCALE = 1 if not given

%--------------------------------------------------------------------------------
% FONT NAME
%--------------------------------------------------------------------------------
FontNameAxes        = 'Symbol';
FontNameUIControls  = 'Helvetica';
%--------------------------------------------------------------------------------
% FONT SIZE (points)
%--------------------------------------------------------------------------------
AxisTickLabels    = 12;        % Axis Tick Labels
AxisXLabel        = 10;        % Axis X Labels
AxisYLabel        = 10;        % Axis Y Labels
AxisTitle         = 10;        % Axis Titles
CheckboxLabels    = 10;        % Labels for the checkboxes
DefaultLabel      =  9;        % All other labels

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not change code below this point.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   
%--------------------------------------------------------------------------------
% Get Handles for objects
%--------------------------------------------------------------------------------
hAxes       = findall(hFig,'type','axes');
hXLabel     = get(hAxes,'XLabel'); hXLabel = [hXLabel{:}]; %Comment 2nd part out
hYLabel     = get(hAxes,'YLabel'); hYLabel = [hYLabel{:}]; % if more than one
hTitle      = get(hAxes,'Title');  hTitle = [hTitle{:}];
hUIControls = findall(hFig,'type','uicontrol');
hCheckboxLabels    = findall(hUIControls,'style','checkbox');

%--------------------------------------------------------------------------------
% Set FontName
%--------------------------------------------------------------------------------
set(hAxes,'FontName',FontNameAxes);
set(hUIControls,'FontName',FontNameUIControls);
%--------------------------------------------------------------------------------
% Set FontSizes
%--------------------------------------------------------------------------------
hObj = [hAxes; hXLabel'; hYLabel'; hTitle'; hUIControls];
OldUnits = get(hObj,'FontUnits');
set(hObj,'FontUnits','Points');
set(hAxes  ,              'FontSize', SCALE*AxisTickLabels);
set(hXLabel,              'FontSize', SCALE*AxisXLabel);
set(hYLabel,              'FontSize', SCALE*AxisYLabel);
set(hTitle,               'FontSize', SCALE*AxisTitle);
set(hUIControls,          'FontSize', SCALE*DefaultLabel);
set(hCheckboxLabels,      'FontSize', SCALE*CheckboxLabels);
set(hObj,{'FontUnits'},OldUnits);

switch computer
case 'MAC2'
   % On MAC, baseline of text inside edit boxes remains at same
   % vertical position irregardless of change in font size.
   % To properly align text, here the old edit boxes are deleted
   % and new ones created with the proper size.
   hEd = findall(gcf,'type','uicontrol','style','edit');
   OldFontUnits = get(hEd,'FontUnits');
   hEdNew = zeros(size(hEd));
   warning off; % Turn off warning about units
   for i = 1:length(hEd)
      Props = get(hEd(i));
      Props = rmfield(Props,{'Extent','Type','FontSize','FontUnits'});
      delete(hEd(i));
      hEdNew(i) = uicontrol('FontUnits','Normalized','FontSize',0.35,Props);
   end
   warning on;
   set(hEdNew,'FontUnits',OldFontUnits);
end

_________________

Simulation
Private Nachricht senden Benutzer-Profile anzeigen
 
outsider
Forum-Meister

Forum-Meister


Beiträge: 806
Anmeldedatum: 03.09.07
Wohnort: München
Version: R2012b
     Beitrag Verfasst am: 20.04.2009, 20:01     Titel:
  Antworten mit Zitat      
das gleiche in 3 Zeilen (ohne MAC-Unterstützung)
Code:
% fig = figure handle
% scl = scale factor
kids = findobj(fig); % evtl. findall
kids = kids(arrayfun(@(x) isfield(get(x),'FontSize'),kids));
arrayfun(@(x) set(x,'FontSize',get(x,'FontSize')*scl),kids);



MfG
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2024 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.