-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed/updated the font generation tool. Updated the RBX.Lua module. Removed support for TextStrokeTransparency (it was not good).
- Loading branch information
EgoMoose
committed
Oct 20, 2016
1 parent
56fdc50
commit ff9c05b
Showing
127 changed files
with
33,923 additions
and
24,491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomFontRenderingForm", "CustomFontRenderingForm\CustomFontRenderingForm.csproj", "{C6FBDF10-3F8A-488D-8548-2DEFB56056E8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C6FBDF10-3F8A-488D-8548-2DEFB56056E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C6FBDF10-3F8A-488D-8548-2DEFB56056E8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C6FBDF10-3F8A-488D-8548-2DEFB56056E8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C6FBDF10-3F8A-488D-8548-2DEFB56056E8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
2 changes: 1 addition & 1 deletion
2
.../RbxFontBuilder/RbxFontBuilder/App.config → ...ngForm/CustomFontRenderingForm/App.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
114 changes: 114 additions & 0 deletions
114
CustomFontRenderingForm/CustomFontRenderingForm/CustomFontRenderingForm.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\packages\SharpFont.4.0.1\build\SharpFont.props" Condition="Exists('..\packages\SharpFont.4.0.1\build\SharpFont.props')" /> | ||
<Import Project="..\packages\SharpFont.Dependencies.2.6\build\SharpFont.Dependencies.props" Condition="Exists('..\packages\SharpFont.Dependencies.2.6\build\SharpFont.Dependencies.props')" /> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{C6FBDF10-3F8A-488D-8548-2DEFB56056E8}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CustomFontRenderingForm</RootNamespace> | ||
<AssemblyName>CustomFontRenderingForm</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<ApplicationIcon>Resources\style.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="SharpFont, Version=4.0.1.200, Culture=neutral, PublicKeyToken=48add4c483071cdf, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\SharpFont.4.0.1\lib\net45\SharpFont.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Deployment" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="FontInfo.cs" /> | ||
<Compile Include="InputGUI.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="InputGUI.Designer.cs"> | ||
<DependentUpon>InputGUI.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="SpriteSheet.cs" /> | ||
<EmbeddedResource Include="InputGUI.resx"> | ||
<DependentUpon>InputGUI.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
<SubType>Designer</SubType> | ||
</EmbeddedResource> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<None Include="packages.config" /> | ||
<None Include="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
<Compile Include="Properties\Settings.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="Resources\style.ico" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\SharpFont.Dependencies.2.6\build\SharpFont.Dependencies.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SharpFont.Dependencies.2.6\build\SharpFont.Dependencies.props'))" /> | ||
<Error Condition="!Exists('..\packages\SharpFont.4.0.1\build\SharpFont.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SharpFont.4.0.1\build\SharpFont.props'))" /> | ||
</Target> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
181 changes: 181 additions & 0 deletions
181
CustomFontRenderingForm/CustomFontRenderingForm/FontInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
|
||
namespace CustomFontRenderingForm | ||
{ | ||
class FontInfo | ||
{ | ||
public string fontName; | ||
public int fontSize, lineHeight, firstAdjust; | ||
|
||
public List<CharacterInfo> characters = new List<CharacterInfo>(); | ||
public Dictionary<char, Dictionary<char, KerningInfo>> kerning = new Dictionary<char, Dictionary<char, KerningInfo>>(); | ||
|
||
public FontInfo(string fontName, int fontSize) | ||
{ | ||
this.fontName = fontName; | ||
this.fontSize = fontSize; | ||
} | ||
|
||
public void addCharacter(CharacterInfo info) | ||
{ | ||
characters.Add(info); | ||
} | ||
|
||
public void addKerning(KerningInfo info) | ||
{ | ||
if (!kerning.ContainsKey(info.character1)) | ||
{ | ||
kerning[info.character1] = new Dictionary<char, KerningInfo>(); | ||
} | ||
kerning[info.character1][info.character2] = info; | ||
} | ||
|
||
public string makeJSON(string indent) | ||
{ | ||
string indent2 = indent + "\t"; | ||
string indent3 = indent + "\t\t"; | ||
string indent4 = indent + "\t\t\t"; | ||
|
||
string json = indent + "\"" + fontSize + "\" : {\n" | ||
+ indent2 + "\"lineHeight\" : " + lineHeight + ",\n" | ||
+ indent2 + "\"firstAdjust\" : " + firstAdjust + ",\n" | ||
+ indent2 + "\"characters\" : {\n"; | ||
|
||
// Reflection is pretty dope! | ||
int count = 0; | ||
foreach (CharacterInfo info in characters) | ||
{ | ||
count++; | ||
string line = indent3 + "\"" + (byte)info.character + "\" : { "; | ||
FieldInfo[] fields = typeof(CharacterInfo).GetFields(); | ||
int count2 = 0; | ||
for (int i = 0; i < fields.Length; i++) | ||
{ | ||
FieldInfo f = fields[i]; | ||
string prop = f.Name; | ||
if (prop != "character") | ||
{ | ||
count2++; | ||
object value = f.GetValue(info); | ||
line += "\"" + prop + "\" : " + value + (count2 < (fields.Length - 1) ? ", " : " "); | ||
} | ||
} | ||
line += "}" + (count < characters.Count ? ",\n" : "\n"); | ||
json += line; | ||
} | ||
json += indent2 + "},\n" + indent2 + "\"kerning\" : {\n"; | ||
|
||
count = 0; | ||
foreach (KeyValuePair<char, Dictionary<char, KerningInfo>> kvp in kerning) | ||
{ | ||
count++; | ||
int count2 = 0; | ||
string line = indent3 + "\"" + (byte)kvp.Key + "\" : {\n"; | ||
foreach (KeyValuePair<char, KerningInfo> kvp2 in kvp.Value) | ||
{ | ||
count2++; | ||
KerningInfo info = kvp2.Value; | ||
line += indent4 + "\"" + (byte)info.character2 + "\" : { " | ||
+ "\"kernX\" : " + info.kernX | ||
+ ", \"kernY\" : " + info.kernY + " }" | ||
+ (count2 < kvp.Value.Count ? "," : "") + "\n"; | ||
} | ||
line += indent3 + "}" + (count < kerning.Count ? "," : "") + "\n"; | ||
json += line; | ||
} | ||
json += indent2 + "}\n" + indent + "}"; | ||
return json; | ||
} | ||
|
||
public string makeLua(string indent) | ||
{ | ||
string indent2 = indent + "\t"; | ||
string indent3 = indent + "\t\t"; | ||
string indent4 = indent + "\t\t\t"; | ||
|
||
string json = indent + "[\"" + fontSize + "\"] = {\n" | ||
+ indent2 + "lineHeight = " + lineHeight + ",\n" | ||
+ indent2 + "firstAdjust = " + firstAdjust + ",\n" | ||
+ indent2 + "characters = {\n"; | ||
|
||
// Reflection is pretty dope! | ||
int count = 0; | ||
foreach (CharacterInfo info in characters) | ||
{ | ||
count++; | ||
string line = indent3 + "[\"" + (byte)info.character + "\"] = { "; | ||
FieldInfo[] fields = typeof(CharacterInfo).GetFields(); | ||
int count2 = 0; | ||
for (int i = 0; i < fields.Length; i++) | ||
{ | ||
FieldInfo f = fields[i]; | ||
string prop = f.Name; | ||
if (prop != "character") | ||
{ | ||
count2++; | ||
object value = f.GetValue(info); | ||
line += prop + " = " + value + (count2 < (fields.Length - 1) ? ", " : " "); | ||
} | ||
} | ||
line += "}" + (count < characters.Count ? ",\n" : "\n"); | ||
json += line; | ||
} | ||
json += indent2 + "},\n" + indent2 + "kerning = {\n"; | ||
|
||
count = 0; | ||
foreach (KeyValuePair<char, Dictionary<char, KerningInfo>> kvp in kerning) | ||
{ | ||
count++; | ||
int count2 = 0; | ||
string line = indent3 + "[\"" + (byte)kvp.Key + "\"] = {\n"; | ||
foreach (KeyValuePair<char, KerningInfo> kvp2 in kvp.Value) | ||
{ | ||
count2++; | ||
KerningInfo info = kvp2.Value; | ||
line += indent4 + "[\"" + (byte)info.character2 + "\"] = { " | ||
+ "kernX = " + info.kernX | ||
+ ", kernY = " + info.kernY + " }" | ||
+ (count2 < kvp.Value.Count ? "," : "") + "\n"; | ||
} | ||
line += indent3 + "}" + (count < kerning.Count ? "," : "") + "\n"; | ||
json += line; | ||
} | ||
json += indent2 + "}\n" + indent + "}"; | ||
return json; | ||
} | ||
} | ||
|
||
class CharacterInfo | ||
{ | ||
public char character; | ||
public int x, y, width, height, xadvance, yoffset, atlas; | ||
|
||
public CharacterInfo(char character, int x, int y, int width, int height, int xadvance, int yoffset, int atlas) | ||
{ | ||
this.character = character; | ||
this.x = x; | ||
this.y = y; | ||
this.width = width; | ||
this.height = height; | ||
this.xadvance = xadvance; | ||
this.yoffset = yoffset; | ||
this.atlas = atlas; | ||
} | ||
} | ||
|
||
class KerningInfo | ||
{ | ||
public char character1, character2; | ||
public int kernX, kernY; | ||
|
||
public KerningInfo(char character1, char character2, int kernX, int kernY) | ||
{ | ||
this.character1 = character1; | ||
this.character2 = character2; | ||
this.kernX = kernX; | ||
this.kernY = kernY; | ||
} | ||
} | ||
} |
Oops, something went wrong.