Commit ccdbc23d authored by Ben Avison's avatar Ben Avison
Browse files

Make FontManager softload on modern ROL OS versions.

Detail:
  In recent ROL OS versions, the font cache dynamic area is managed
  entirely by the FontManager module -- the kernel no longer creates
  this dynamic area itself. This change prevented the UCS FontManager
  from loading, as it expected the font cache to already exist.

  The FontManager code has been modified to create the font cache DA
  itself if it detects that it does not exist. It will destroy the
  font cache DA on finalisation if it created the DA in the first place
  and it provides an appropriate dynamic area handler to process DA
  resize requests.

  So as to permit loading this version of the FontManager on all OS
  versions, the Font_ChangeArea SWI is still provided, the module
  initialisation code will do the right thing if it detects that the
  font cache DA already exists, and the finalisation code will only
  destroy the font cache DA if it was created by the initialisation
  code.
Admin:
  Contributed by John-Mark Bell.
  Tested on an A9home with RO 4.42. This worked fine with the A9home's
  built-in ROM fonts. Additionally tested with a softloaded copy of the
  ROMFonts module from RO 5.11. This also performed as expected.
  Successfully tested UCS functionality using NetSurf with both language
  (Marugothic, Song) and symbol (TTF2f conversions of Cyberbit and others)
  fonts.
  Also successfully tested on RO 5.11, indicating no regression in
  behaviour.
  Unsuccessfully tested on RO 4.02 under RPCEmu. A vanilla build of
  FM 3.60 also fails on this setup. In both cases, the DPI values listed
  by *FontList are 4294967205 (= (2^32-1) - 90), which implies that the
  DPI calculations have been broken at some point. A 26bit version of
  FM 3.54 does not exhibit this behaviour.

Version 3.61. Tagged as 'Manager-3_61'
parent f06bd3a7
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "3.60"
Module_Version SETA 360
Module_MajorVersion SETS "3.61"
Module_Version SETA 361
Module_MinorVersion SETS ""
Module_Date SETS "03 Aug 2005"
Module_ApplicationDate SETS "03-Aug-05"
Module_Date SETS "06 Jun 2008"
Module_ApplicationDate SETS "06-Jun-08"
Module_ComponentName SETS "Manager"
Module_ComponentPath SETS "RiscOS/Sources/Video/Render/Fonts/Manager"
Module_FullVersion SETS "3.60"
Module_HelpVersion SETS "3.60 (03 Aug 2005)"
Module_ComponentPath SETS "castle/RiscOS/Sources/Video/Render/Fonts/Manager"
Module_FullVersion SETS "3.61"
Module_HelpVersion SETS "3.61 (06 Jun 2008)"
END
/* (3.60)
/* (3.61)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.2.
*
*/
#define Module_MajorVersion_CMHG 3.60
#define Module_MajorVersion_CMHG 3.61
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 03 Aug 2005
#define Module_Date_CMHG 06 Jun 2008
#define Module_MajorVersion "3.60"
#define Module_Version 360
#define Module_MajorVersion "3.61"
#define Module_Version 361
#define Module_MinorVersion ""
#define Module_Date "03 Aug 2005"
#define Module_Date "06 Jun 2008"
#define Module_ApplicationDate "03-Aug-05"
#define Module_ApplicationDate "06-Jun-08"
#define Module_ComponentName "Manager"
#define Module_ComponentPath "RiscOS/Sources/Video/Render/Fonts/Manager"
#define Module_ComponentPath "castle/RiscOS/Sources/Video/Render/Fonts/Manager"
#define Module_FullVersion "3.60"
#define Module_HelpVersion "3.60 (03 Aug 2005)"
#define Module_LibraryVersionInfo "3:60"
#define Module_FullVersion "3.61"
#define Module_HelpVersion "3.61 (06 Jun 2008)"
#define Module_LibraryVersionInfo "3:61"
......@@ -492,6 +492,7 @@ false SETL {FALSE}
GBLL blending ; support for background blending
GBLL blendingOn ; ignore bit 11 on font paint and always blend
GBLL ownDA ; we own the Font Cache DA
GBLL debugxx
GBLL debugrgb
......@@ -607,6 +608,7 @@ bigfontmax SETL Version >= 341 ; FontMax in CMOS uses 64K units
blending SETL true ; blending *enabled* by default
blendingOn SETL false ; blending only enabled when Font_Paint bit 11 set
ownDA SETL true ; we own the Font Cache DA
[ blending
! 0, "Background blending enabled"
......@@ -1412,6 +1414,10 @@ fontcachesize # 4 ; set up in initialisation
maxcache # 4 ; set up in initialisation
mincache # 4 ; reset in ChangeDynamicArea
fontcacheend # 4
[ ownDA
owncache # 1 ; whether we own the font cache
align data
]
threshold1 # 4 ; max pixel height for scaled bitmaps
threshold2 # 4 ; max pixel height for 4-bpp
......@@ -3665,10 +3671,35 @@ Init Entry "R0-R3,R12"
MOVVC R0,#ReadCMOS ; set cache size to configured amount
MOVVC R1,#FontCMOS
SWIVC XOS_Byte ; read font cache size setting
MOVVC R0,#4 ; Font Manager uses dynamic area 4
SWIVC XOS_ReadDynamicArea ; R0 --> memory, R1 = current size
BVS exitinit
MOV R0,#4 ; Font Manager uses dynamic area 4
SWI XOS_ReadDynamicArea ; Attempt to read area details
[ ownDA
MOVVC R2,#0
STRVCB R2,owncache ; flag that we don't own the cache
BVC da_exists
ADR R8,fc_name
MOV R7,wsptr
ADRL R6,DynAreaHandler_FontArea
MOV R5,#32*1024*1024 ; 32MB max size
MOV R4,#2 ; no USR mode access
MOV R3,#-1
MOV R2,#0 ; Initially empty
MOV R1,#4 ; Font cache DA is number 4
MOV R0,#0
SWI XOS_DynamicArea ; create font cache
STRVCB R1,owncache ; flag that we own the cache (r1 = 4)
MOVVC R0,R3
MOVVC R1,#0 ; Match initial size
]
BVS exitinit ; Failed -> bail
; R0 -> start of cache
; R1 = cache size
da_exists
MOV R2,R2,LSL #12 ; R2 * 4k = new size
[ Version >= 296
LDR R14,pagesize
......@@ -3777,6 +3808,10 @@ fontcache_com1 DCB "Set File$Type_FCF $FileType_FontCache_Name", 0
fontcache_com2 DCB "Set Alias$@RunType_FCF LoadFontCache ", 0
fontcache_com3 DCB "Set Alias$@LoadType_FCF LoadFontCache ", 0
[ ownDA
fc_name DCB "Font Cache",0
]
ALIGN
;-----------------------------------------------------------------------------
......@@ -3988,6 +4023,14 @@ Die Entry "R0-R3,R12"
SUBS R3,R3,#1
BNE %BT01
[ ownDA
LDRB R0,owncache ; remove font cache DA, iff we own it
TEQ R0,#0
MOVNE R0,#1
MOVNE R1,#4
SWINE XOS_DynamicArea ; ignore errors
]
softdie
; Bug fix by Chris:
......@@ -8698,6 +8741,7 @@ SWIFont_EnumerateCharacters Entry "R3-R8"
; SWI &400BF - change size of font cache (called by OS_ChangeDynamicArea)
; In R1 = new font cache size (-1 ==> don't change size)
; actually, there's a bug: if R1 > current size, then R1 must be altered to currentsize - | R1-currentsize |
; R12 -> workspace
; Out R2 = minimum font cache size
SWIFont_ChangeArea Entry "R0-R1,R3-R11"
......@@ -8769,4 +8813,54 @@ SWIFont_ChangeArea Entry "R0-R1,R3-R11"
99
PullS "$Proc_RegList"
[ ownDA
DynAreaHandler_FontArea
CMP r0, #4
ADDCC pc, pc, r0, LSL #2
B UnknownHandlerError
B PreGrow_FontArea
B PostGrow_FontArea
B PreShrink_FontArea
B PostShrink_FontArea
MakeErrorBlock UnknownAreaHandler
UnknownHandlerError
Push "lr"
ADR r0, ErrorBlock_UnknownAreaHandler
SETV
Pull "pc"
PostGrow_FontArea Entry "r0-r2"
; in - r3 = size change (+ve), r4 = new size, r5 = page size
MOV r1, r4 ; there are, so inform font manager of size change
BL SWIFont_ChangeArea
CLRV
EXIT
PostShrink_FontArea
PreGrow_FontArea
CLRV ; don't need to do anything here
MOV pc, lr ; so just exit
PreShrink_FontArea Entry "r0-r2"
MOV r1, #-1 ; ask font manager for minimum size of font area
MOV r2, #0 ; default value if no font manager
BL SWIFont_ChangeArea ; out: r2 = minimum size
SUB r0, r4, r2 ; r0 = current-minimum = max shrink
CMP r3, r0 ; if requested shrink > max
MOVHI r3, r0 ; then limit it
SUB r0, r5, #1 ; r0 = page mask
BIC r3, r3, r0 ; round size change down to page multiple
SUB r1, r4, r3 ; r1 = new size
BL SWIFont_ChangeArea ; tell font manager to reduce usage
CLRV
EXIT
]
END
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment