Commits (1)
  • Robert Sprowson's avatar
    Fallback to system font if Wimp$Font is unset · 6c0a0c7f
    Robert Sprowson authored
    If the configured desktop font is 0 (use Wimp$Font) but that variable is unset, use system font instead like the Wimp does rather than failing to get a font handle from Font Manager.
    Refactor the extraction of configured font from CMOS using bitshift and mask future tech.
    
    Version 2.04. Tagged as 'Chars-2_04'
    6c0a0c7f
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "2.03" Module_MajorVersion SETS "2.04"
Module_Version SETA 203 Module_Version SETA 204
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "12 Aug 2017" Module_Date SETS "13 Apr 2018"
Module_ApplicationDate SETS "12-Aug-17" Module_ApplicationDate SETS "13-Apr-18"
Module_ComponentName SETS "Chars" Module_ComponentName SETS "Chars"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Chars" Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Chars"
Module_FullVersion SETS "2.03" Module_FullVersion SETS "2.04"
Module_HelpVersion SETS "2.03 (12 Aug 2017)" Module_HelpVersion SETS "2.04 (13 Apr 2018)"
END END
/* (2.03) /* (2.04)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 2.03 #define Module_MajorVersion_CMHG 2.04
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 12 Aug 2017 #define Module_Date_CMHG 13 Apr 2018
#define Module_MajorVersion "2.03" #define Module_MajorVersion "2.04"
#define Module_Version 203 #define Module_Version 204
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "12 Aug 2017" #define Module_Date "13 Apr 2018"
#define Module_ApplicationDate "12-Aug-17" #define Module_ApplicationDate "13-Apr-18"
#define Module_ComponentName "Chars" #define Module_ComponentName "Chars"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Chars" #define Module_ComponentPath "castle/RiscOS/Sources/Apps/Chars"
#define Module_FullVersion "2.03" #define Module_FullVersion "2.04"
#define Module_HelpVersion "2.03 (12 Aug 2017)" #define Module_HelpVersion "2.04 (13 Apr 2018)"
#define Module_LibraryVersionInfo "2:3" #define Module_LibraryVersionInfo "2:4"
...@@ -202,16 +202,13 @@ SYS "XOS_GenerateError",Block% TO a$ ...@@ -202,16 +202,13 @@ SYS "XOS_GenerateError",Block% TO a$
DEF FNchars_getdesktopfont DEF FNchars_getdesktopfont
REM Returns a handle and name for the Desktop font REM Returns a handle and name for the Desktop font
LOCAL len%,i%,bit%,data%,dfhandle%,df$ LOCAL len%,flags%,data%,dfhandle%,df$
dfhandle%=0
SYS "OS_Byte",161,140 TO ,,data% SYS "OS_Byte",161,140 TO ,,data%
FOR i%=0 TO 3 dfhandle%=(data% AND&1E)>>1:REM Extract WimpFont configuration bits
IF (data% AND (1<<i%+1)) THEN bit%=1 ELSE bit%=0
dfhandle%=dfhandle%+(bit%*(2^i%))
NEXT i%
CASE dfhandle% OF CASE dfhandle% OF
WHEN 0: WHEN 0:
SYS "OS_ReadVarVal","Wimp$Font",Block%,255,0,3 TO ,,len% SYS "XOS_ReadVarVal","Wimp$Font",Block%,255,0,3 TO ,,len%;flags%
IF(flags% AND1)=1 THEN=FNmsg_get("DF1"):REM Fall back to system font
Block%?len%=13:df$=$Block% Block%?len%=13:df$=$Block%
WHEN 1,2,3,4,5,6,7,8,9,10,11,12,13,14: WHEN 1,2,3,4,5,6,7,8,9,10,11,12,13,14:
df$=FNmsg_get("DF"+STR$dfhandle%) df$=FNmsg_get("DF"+STR$dfhandle%)
......