Compare commits
6 Commits
ChaChaFont
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acb93a64cf | ||
|
|
8e686ec5ce | ||
|
|
3dd5921229 | ||
|
|
b54423ca4f | ||
|
|
05e99368f8 | ||
|
|
ea82d89567 |
@@ -1,10 +1,20 @@
|
||||
class ChaChaFontInfo expands FontInfo;
|
||||
|
||||
class ChaChaFontInfo expands IChaChaFontInfo;
|
||||
|
||||
|
||||
/********************************
|
||||
Modification of FontInfo so that:
|
||||
- it does not rely on static fonts anymore
|
||||
- add ability to force disableScaling when requesting a Font:
|
||||
- GlobalForceScalingState(bool) change it for ALL next requests (/!\ this class might be shared)
|
||||
- GetUnscaledFontBySize(float) can be used to get unscaled font on-demand
|
||||
*********************************/
|
||||
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT6 FONTNAME="Unreal Tournament" HEIGHT=6 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT8 FONTNAME="Unreal Tournament" HEIGHT=8 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT10 FONTNAME="Unreal Tournament" HEIGHT=10 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT12 FONTNAME="Unreal Tournament" HEIGHT=12 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT14 FONTNAME="Unreal Tournament" HEIGHT=14 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT16 FONTNAME="Unreal Tournament" HEIGHT=16 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT18 FONTNAME="Unreal Tournament" HEIGHT=18 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT20 FONTNAME="Unreal Tournament" HEIGHT=20 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT22 FONTNAME="Unreal Tournament" HEIGHT=22 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT24 FONTNAME="Unreal Tournament" HEIGHT=24 ANTIAlIAS=TRUE
|
||||
@@ -14,13 +24,78 @@ class ChaChaFontInfo expands FontInfo;
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT48 FONTNAME="Unreal Tournament" HEIGHT=48 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT54 FONTNAME="Unreal Tournament" HEIGHT=54 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT60 FONTNAME="Unreal Tournament" HEIGHT=60 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=UnrealT90 FONTNAME="Unreal Tournament" HEIGHT=90 ANTIAlIAS=TRUE
|
||||
|
||||
var Font FontClass[14];
|
||||
var Font FontClass[16];
|
||||
|
||||
var bool bDisableScaling;
|
||||
|
||||
function GlobalForceScalingState(bool bState)
|
||||
{
|
||||
bDisableScaling = !bState;
|
||||
SetScalingState(bState);
|
||||
}
|
||||
|
||||
function Font GetHugeUnscaledFont(float Width)
|
||||
{
|
||||
return GetUnscaledFontIndex(6,Width);
|
||||
}
|
||||
|
||||
function Font GetBigUnscaledFont(float Width)
|
||||
{
|
||||
return GetUnscaledFontIndex(5,Width);
|
||||
}
|
||||
|
||||
function Font GetMediumUnscaledFont(float Width)
|
||||
{
|
||||
return GetUnscaledFontIndex(4,Width);
|
||||
}
|
||||
|
||||
function Font GetSmallUnscaledFont(float Width)
|
||||
{
|
||||
return GetUnscaledFontIndex(3,Width);
|
||||
}
|
||||
|
||||
function Font GetSmallestUnscaledFont(float Width)
|
||||
{
|
||||
return GetUnscaledFontIndex(2,Width);
|
||||
}
|
||||
|
||||
function Font GetAReallySmallUnscaledFont(float Width)
|
||||
{
|
||||
return GetUnscaledFontIndex(1,Width);
|
||||
}
|
||||
|
||||
function Font GetACompletelyUnreadableUnscaledFont(float Width)
|
||||
{
|
||||
return GetUnscaledFontIndex(0,Width);
|
||||
}
|
||||
|
||||
function Font GetUnscaledFontIndex(int i, float Width)
|
||||
{
|
||||
local Font GeneratedFont;
|
||||
local float SavedCurrentInGameScalingFactor;
|
||||
local bool SavebDisableScaling;
|
||||
|
||||
SavedCurrentInGameScalingFactor = CurrentInGameScalingFactor;
|
||||
SavebDisableScaling = bDisableScaling;
|
||||
|
||||
bDisableScaling = True;
|
||||
CurrentInGameScalingFactor = 1;
|
||||
|
||||
GeneratedFont=GetFontIndex(i,Width);
|
||||
|
||||
CurrentInGameScalingFactor = SavedCurrentInGameScalingFactor;
|
||||
bDisableScaling = SavebDisableScaling;
|
||||
|
||||
return GeneratedFont;
|
||||
}
|
||||
|
||||
function Font GetFontIndex(int i, float Width)
|
||||
{
|
||||
if ( CurrentInGameScalingFactor != InGameScalingFactor )
|
||||
SetScalingState(True);
|
||||
if ( bCurrentInGameScaling != bEnableInGameScaling ||
|
||||
CurrentInGameScalingFactor != InGameScalingFactor )
|
||||
SetScalingState(bEnableInGameScaling);
|
||||
|
||||
if ( (SavedFont[i] != None) && (Width == SavedWidth[i]) )
|
||||
return SavedFont[i];
|
||||
@@ -49,21 +124,22 @@ function SetScalingState(bool bEnableScaling)
|
||||
if ( !bCacheSetup )
|
||||
{
|
||||
bCacheSetup = true;
|
||||
AddNewFontCache( Font'SmallFont', 0, 7);
|
||||
AddNewFontCache(FontClass[0], 7, 10);
|
||||
AddNewFontCache(FontClass[1], 10, 12);
|
||||
AddNewFontCache(FontClass[2], 12, 14);
|
||||
AddNewFontCache(FontClass[3], 14, 16);
|
||||
AddNewFontCache(FontClass[4], 16, 20);
|
||||
AddNewFontCache(FontClass[5], 20, 22);
|
||||
AddNewFontCache(FontClass[6], 22, 24);
|
||||
AddNewFontCache(FontClass[7], 24, 30);
|
||||
AddNewFontCache(FontClass[8], 30, 36);
|
||||
AddNewFontCache(FontClass[9], 36, 42);
|
||||
AddNewFontCache(FontClass[10], 42, 48);
|
||||
AddNewFontCache(FontClass[11], 48, 54);
|
||||
AddNewFontCache(FontClass[12], 54, 60);
|
||||
AddNewFontCache(FontClass[13], 60, 85);
|
||||
AddNewFontCache(FontClass[0], 0, 7);
|
||||
AddNewFontCache(FontClass[1], 7, 10);
|
||||
AddNewFontCache(FontClass[2], 10, 12);
|
||||
AddNewFontCache(FontClass[3], 12, 14);
|
||||
AddNewFontCache(FontClass[4], 14, 16);
|
||||
AddNewFontCache(FontClass[5], 16, 20);
|
||||
AddNewFontCache(FontClass[6], 20, 22);
|
||||
AddNewFontCache(FontClass[7], 22, 24);
|
||||
AddNewFontCache(FontClass[8], 24, 30);
|
||||
AddNewFontCache(FontClass[9], 30, 36);
|
||||
AddNewFontCache(FontClass[10], 36, 42);
|
||||
AddNewFontCache(FontClass[11], 42, 48);
|
||||
AddNewFontCache(FontClass[12], 48, 54);
|
||||
AddNewFontCache(FontClass[13], 54, 60);
|
||||
AddNewFontCache(FontClass[14], 60, 85);
|
||||
AddNewFontCache(FontClass[15], 85, 110);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,27 +150,62 @@ function SetScalingState(bool bEnableScaling)
|
||||
SavedWidth[i] = 0;
|
||||
}
|
||||
|
||||
bEnableInGameScaling = True;
|
||||
bCurrentInGameScaling = True;
|
||||
CurrentInGameScalingFactor = InGameScalingFactor;
|
||||
bEnableInGameScaling = bEnableScaling;
|
||||
bCurrentInGameScaling = bEnableScaling;
|
||||
if(bDisableScaling || (!bEnableInGameScaling))
|
||||
{
|
||||
CurrentInGameScalingFactor = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentInGameScalingFactor = InGameScalingFactor;
|
||||
}
|
||||
}
|
||||
|
||||
//Copy of original except using CurrentInGameScalingFactor to avoid modifying InGameScalingFactor
|
||||
function Font GetFontBySize(float IdealSize)
|
||||
{
|
||||
local int i;
|
||||
local float NewBase;
|
||||
local Font NewFont;
|
||||
|
||||
// Don't blow up the dynamic font cache
|
||||
IdealSize = fClamp( Abs(IdealSize) * CurrentInGameScalingFactor, 6, 100 );
|
||||
For ( i=0 ; i<CachedFonts.Length ; i++ )
|
||||
if ( (IdealSize >= CachedFonts[i].MinSize) && (IdealSize <= CachedFonts[i].MaxSize) )
|
||||
return CachedFonts[i].Font;
|
||||
|
||||
// Dynamically created fonts will scale up using 'Square(X)' where X increments by 0.5
|
||||
NewBase = Sqrt(IdealSize);
|
||||
NewBase = NewBase - (NewBase % 0.5);
|
||||
NewFont = class'Canvas'.static.CreateFont( FF_Arial, int(Square(NewBase)), false, false, false, false, true);
|
||||
|
||||
// Font could not be created, choose latest in cache
|
||||
if ( NewFont == None )
|
||||
return CachedFonts[CachedFonts.Length-1].Font;
|
||||
|
||||
AddNewFontCache( NewFont, Square(NewBase), Square(NewBase+0.5) );
|
||||
return NewFont;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
FontClass(0)=Font'UnrealT10'
|
||||
FontClass(1)=Font'UnrealT12'
|
||||
FontClass(2)=Font'UnrealT14'
|
||||
FontClass(3)=Font'UnrealT16'
|
||||
FontClass(4)=Font'UnrealT18'
|
||||
FontClass(5)=Font'UnrealT20'
|
||||
FontClass(6)=Font'UnrealT22'
|
||||
FontClass(7)=Font'UnrealT24'
|
||||
FontClass(8)=Font'UnrealT30'
|
||||
FontClass(9)=Font'UnrealT36'
|
||||
FontClass(10)=Font'UnrealT42'
|
||||
FontClass(11)=Font'UnrealT48'
|
||||
FontClass(12)=Font'UnrealT54'
|
||||
FontClass(13)=Font'UnrealT60'
|
||||
FontClass(0)=Font'UnrealT6'
|
||||
FontClass(1)=Font'UnrealT8'
|
||||
FontClass(2)=Font'UnrealT10'
|
||||
FontClass(3)=Font'UnrealT12'
|
||||
FontClass(4)=Font'UnrealT14'
|
||||
FontClass(5)=Font'UnrealT16'
|
||||
FontClass(6)=Font'UnrealT20'
|
||||
FontClass(7)=Font'UnrealT22'
|
||||
FontClass(8)=Font'UnrealT24'
|
||||
FontClass(9)=Font'UnrealT30'
|
||||
FontClass(10)=Font'UnrealT36'
|
||||
FontClass(11)=Font'UnrealT42'
|
||||
FontClass(12)=Font'UnrealT48'
|
||||
FontClass(13)=Font'UnrealT54'
|
||||
FontClass(14)=Font'UnrealT60'
|
||||
FontClass(15)=Font'UnrealT90'
|
||||
bEnableInGameScaling=True
|
||||
bCurrentInGameScaling=True
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
class ChaChaFontInfo_ReggaeOne expands ChaChaFontInfo;
|
||||
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT6 FONTNAME="Reggae One Regular" HEIGHT=6 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT8 FONTNAME="Reggae One Regular" HEIGHT=8 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT10 FONTNAME="Reggae One Regular" HEIGHT=10 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT12 FONTNAME="Reggae One Regular" HEIGHT=12 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT14 FONTNAME="Reggae One Regular" HEIGHT=14 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT16 FONTNAME="Reggae One Regular" HEIGHT=16 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT18 FONTNAME="Reggae One Regular" HEIGHT=18 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT20 FONTNAME="Reggae One Regular" HEIGHT=20 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT22 FONTNAME="Reggae One Regular" HEIGHT=22 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT24 FONTNAME="Reggae One Regular" HEIGHT=24 ANTIAlIAS=TRUE
|
||||
@@ -14,22 +15,28 @@ class ChaChaFontInfo_ReggaeOne expands ChaChaFontInfo;
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT48 FONTNAME="Reggae One Regular" HEIGHT=48 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT54 FONTNAME="Reggae One Regular" HEIGHT=54 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT60 FONTNAME="Reggae One Regular" HEIGHT=60 ANTIAlIAS=TRUE
|
||||
#exec NEW TRUETYPEFONTFACTORY NAME=ReggaeOneT90 FONTNAME="Reggae One Regular" HEIGHT=90 ANTIAlIAS=TRUE
|
||||
|
||||
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
FontClass(0)=Font'ReggaeOneT10'
|
||||
FontClass(1)=Font'ReggaeOneT12'
|
||||
FontClass(2)=Font'ReggaeOneT14'
|
||||
FontClass(3)=Font'ReggaeOneT16'
|
||||
FontClass(4)=Font'ReggaeOneT18'
|
||||
FontClass(5)=Font'ReggaeOneT20'
|
||||
FontClass(6)=Font'ReggaeOneT22'
|
||||
FontClass(7)=Font'ReggaeOneT24'
|
||||
FontClass(8)=Font'ReggaeOneT30'
|
||||
FontClass(9)=Font'ReggaeOneT36'
|
||||
FontClass(10)=Font'ReggaeOneT42'
|
||||
FontClass(11)=Font'ReggaeOneT48'
|
||||
FontClass(12)=Font'ReggaeOneT54'
|
||||
FontClass(13)=Font'ReggaeOneT60'
|
||||
FontClass(0)=Font'ReggaeOneT6'
|
||||
FontClass(1)=Font'ReggaeOneT8'
|
||||
FontClass(2)=Font'ReggaeOneT10'
|
||||
FontClass(3)=Font'ReggaeOneT12'
|
||||
FontClass(4)=Font'ReggaeOneT14'
|
||||
FontClass(5)=Font'ReggaeOneT16'
|
||||
FontClass(6)=Font'ReggaeOneT20'
|
||||
FontClass(7)=Font'ReggaeOneT22'
|
||||
FontClass(8)=Font'ReggaeOneT24'
|
||||
FontClass(9)=Font'ReggaeOneT30'
|
||||
FontClass(10)=Font'ReggaeOneT36'
|
||||
FontClass(11)=Font'ReggaeOneT42'
|
||||
FontClass(12)=Font'ReggaeOneT48'
|
||||
FontClass(13)=Font'ReggaeOneT54'
|
||||
FontClass(14)=Font'ReggaeOneT60'
|
||||
FontClass(15)=Font'ReggaeOneT90'
|
||||
}
|
||||
|
||||
|
||||
|
||||
91
Classes/ChaChaFontsFull.uc
Normal file
91
Classes/ChaChaFontsFull.uc
Normal file
@@ -0,0 +1,91 @@
|
||||
class ChaChaFontsFull expands IChaChaFonts config(ChaChaFonts);
|
||||
|
||||
|
||||
var int VersionMajor;
|
||||
var int VersionMinor;
|
||||
var int VersionPatch;
|
||||
var config int ConfigFileVersion;
|
||||
|
||||
var ChaChaFontInfo InstFI_BowlbyOne;
|
||||
var ChaChaFontInfo InstFI_BrunoAceSC;
|
||||
var ChaChaFontInfo InstFI_FragmentMono;
|
||||
var ChaChaFontInfo InstFI_Orbitron;
|
||||
var ChaChaFontInfo InstFI_PressStart2P;
|
||||
var ChaChaFontInfo InstFI_ReggaeOne;
|
||||
var ChaChaFontInfo InstFI_RussoOne;
|
||||
var ChaChaFontInfo InstFI_Unispace;
|
||||
var ChaChaFontInfo InstFI_VT323;
|
||||
var ChaChaFontInfo InstFI_Defaut;
|
||||
|
||||
// A dummy Actor Class so that we can look for this actor and found the base Package
|
||||
// => No need to relly on package version (Name)
|
||||
|
||||
simulated function PreBeginPlay()
|
||||
{
|
||||
if(Role == ROLE_Authority) SaveConfig();
|
||||
}
|
||||
|
||||
simulated function IChaChaFontInfo Get(String requestedFont)
|
||||
{
|
||||
switch(requestedFont)
|
||||
{
|
||||
case"BowlbyOne":
|
||||
if(InstFI_BowlbyOne==None)
|
||||
InstFI_BowlbyOne=Spawn(class'ChaChaFontInfo_BowlbyOne',Self);
|
||||
return InstFI_BowlbyOne;
|
||||
|
||||
case"BrunoAceSC":
|
||||
if(InstFI_BrunoAceSC==None)
|
||||
InstFI_BrunoAceSC=Spawn(class'ChaChaFontInfo_BrunoAceSC',Self);
|
||||
return InstFI_BrunoAceSC;
|
||||
|
||||
case"FragmentMono":
|
||||
if(InstFI_FragmentMono==None)
|
||||
InstFI_FragmentMono=Spawn(class'ChaChaFontInfo_FragmentMono',Self);
|
||||
return InstFI_FragmentMono;
|
||||
|
||||
case"Orbitron":
|
||||
if(InstFI_Orbitron==None)
|
||||
InstFI_Orbitron=Spawn(class'ChaChaFontInfo_Orbitron',Self);
|
||||
return InstFI_Orbitron;
|
||||
|
||||
case"PressStart2P":
|
||||
if(InstFI_PressStart2P==None)
|
||||
InstFI_PressStart2P=Spawn(class'ChaChaFontInfo_PressStart2P',Self);
|
||||
return InstFI_PressStart2P;
|
||||
|
||||
case"ReggaeOne":
|
||||
if(InstFI_ReggaeOne==None)
|
||||
InstFI_ReggaeOne=Spawn(class'ChaChaFontInfo_ReggaeOne',Self);
|
||||
return InstFI_ReggaeOne;
|
||||
|
||||
case"RussoOne":
|
||||
if(InstFI_RussoOne==None)
|
||||
InstFI_RussoOne=Spawn(class'ChaChaFontInfo_RussoOne',Self);
|
||||
return InstFI_RussoOne;
|
||||
|
||||
case"Unispace":
|
||||
if(InstFI_Unispace==None)
|
||||
InstFI_Unispace=Spawn(class'ChaChaFontInfo_Unispace',Self);
|
||||
return InstFI_Unispace;
|
||||
|
||||
case"VT323":
|
||||
if(InstFI_VT323==None)
|
||||
InstFI_VT323=Spawn(class'ChaChaFontInfo_VT323',Self);
|
||||
return InstFI_VT323;
|
||||
|
||||
case"Defaut":
|
||||
default:
|
||||
if(InstFI_Defaut==None)
|
||||
InstFI_Defaut=Spawn(class'ChaChaFontInfo',Self);
|
||||
return InstFI_Defaut;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
defaultproperties{
|
||||
VersionMajor=1
|
||||
VersionMinor=0
|
||||
VersionPatch=0
|
||||
ConfigFileVersion=1
|
||||
}
|
||||
BIN
System/ChaChaFontsV1.u
Normal file
BIN
System/ChaChaFontsV1.u
Normal file
Binary file not shown.
8
make.bat
8
make.bat
@@ -1,2 +1,6 @@
|
||||
del %~dp0\..\System\ChaChaFontA001.u
|
||||
%~dp0\..\System\ucc.exe make ChaChaFontA001
|
||||
set UArtifactName=ChaChaFontsV1
|
||||
del %~dp0\..\System\%UArtifactName%.u
|
||||
del %~dp0\System\%UArtifactName%.u
|
||||
%~dp0\..\System\ucc.exe make ini=%~dp0\make.ini
|
||||
%~dp0\..\System\ucc.exe stripsource %UArtifactName%
|
||||
xcopy %~dp0\..\System\%UArtifactName%.u %~dp0\System\
|
||||
32
make.ini
Normal file
32
make.ini
Normal file
@@ -0,0 +1,32 @@
|
||||
[Core.System]
|
||||
Paths=../System/*.u
|
||||
Paths=../Maps/*.unr
|
||||
Paths=../Textures/*.utx
|
||||
Paths=../Sounds/*.uax
|
||||
Paths=../Music/*.umx
|
||||
|
||||
[Engine.Engine]
|
||||
EditorEngine=Editor.EditorEngine
|
||||
Language=int
|
||||
|
||||
[Editor.EditorEngine]
|
||||
CacheSizeMegs=32
|
||||
EditPackages=Core
|
||||
EditPackages=Engine
|
||||
EditPackages=Editor
|
||||
EditPackages=UWindow
|
||||
EditPackages=Fire
|
||||
EditPackages=IpDrv
|
||||
EditPackages=UWeb
|
||||
EditPackages=UBrowser
|
||||
EditPackages=UnrealShare
|
||||
EditPackages=UnrealI
|
||||
EditPackages=UMenu
|
||||
EditPackages=IpServer
|
||||
EditPackages=Botpack
|
||||
EditPackages=UTServerAdmin
|
||||
EditPackages=UTMenu
|
||||
EditPackages=UTBrowser
|
||||
EditPackages=IChaChaFontsV1
|
||||
EditPackages=ChaChaFontsV1
|
||||
|
||||
Reference in New Issue
Block a user