Changeset 457


Ignore:
Timestamp:
Feb 17, 2023, 2:10:24 PM (2 years ago)
Author:
ataylor
Message:

Modify GetNiceDefaultFont to return the PM "Window Text" font setting, if available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Components/ControlsUtility.pas

    r15 r457  
    55uses
    66  Classes, StdCtrls, SysUtils,
    7   ACLUtility,
     7  ACLUtility, StringUtilsUnit,
    88{$ifdef win32}
    99  ExtCtrls, Forms, Controls, ComCtrls, Windows, Messages, Graphics;
     
    121121  OverrideAppFontName: string;
    122122  OverrideAppFontSize: string;
     123  WindowTextFont:      string;
     124  DefaultFontFromIni:  cstring;
     125  DotPos:              integer;
    123126begin
    124127  // For Marco!
    125128  OverrideAppFontName := GetEnv( 'ACL_OVERRIDE_FONT_NAME' );
    126129  OverrideAppFontSize := GetEnv( 'ACL_OVERRIDE_FONT_SIZE' );
     130
     131  // Use PM "Window Text" font if defined
     132  if OverrideAppFontName = '' then
     133  begin
     134    PrfQueryProfileString( HINI_USERPROFILE, // OS2 INI
     135                           'PM_SystemFonts', // app
     136                           'WindowText',     // key
     137                           '',               // default
     138                           DefaultFontFromIni,
     139                           sizeof( DefaultFontFromIni ));
     140    if DefaultFontFromIni <> '' then
     141    begin
     142      WindowTextFont := DefaultFontFromIni;
     143      DotPos := Pos('.', WindowTextFont );
     144      if ( DotPos > 0 ) and ( DotPos < Length( WindowTextFont )) then
     145      begin
     146        OverrideAppFontSize := StrLeft( WindowTextFont, DotPos-1 );
     147        OverrideAppFontName := StrSubstringFrom( WindowTextFont, DotPos+1 );
     148      end;
     149    end;
     150  end;
    127151
    128152  try
     
    219243const
    220244  EndLineStr = #13 +#10;
    221  
     245
    222246Procedure AddBoldedLine( RichEdit: TRichEdit;
    223247                         BoldPart: string;
     
    273297  begin
    274298    ExpandedNodeList.Add( Path + Node.Text );
    275    
     299
    276300    SubNode := Node.getFirstChild;
    277301    while SubNode <> nil do
     
    754778end;
    755779
    756 // Validate component memory and it's owned components
     780// Validate component memory and its owned components
    757781procedure ValidateComponent( Component: TComponent );
    758782var
Note: See TracChangeset for help on using the changeset viewer.