• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MonoGame/FNA Library that extends functionality of the SpriteFont.

BREAKING CHANGE: DynamicSpriteFont had been moved to the project: https://github.com/rds1983/FontStashSharp

SpriteFontPlus

NuGet Build & Publish Chat

Library that extends functionality of the SpriteFont.

Features

  • Creation of SpriteFont in the run-time from ttf.
  • Creation of SpriteFont in the run-time from AngelCode BMFont(only XML with single texture works for now).

Adding Reference

There are two ways of referencing SpriteFontPlus in the project:

  1. Through nuget(works only for MonoGame): https://www.nuget.org/packages/SpriteFontPlus/

  2. As source code(works for both MonoGame and FNA):

    a. Clone this repo.

    b. Execute git submodule update --init --recursive within the folder the repo was cloned to.

    c. Add src/SpriteFontPlus.MonoGame.csproj or src/SpriteFontPlus.FNA.csproj to the solution.

    • If FNA is used, then the folder structure is expected to be following: Folder Structure

Loading SpriteFont from a ttf

Following code creates a SpriteFont from a ttf:

var fontBakeResult = TtfFontBaker.Bake(File.ReadAllBytes(@"C:\\Windows\\Fonts\arial.ttf"),
	25,
	1024,
	1024,
	new[]
	{
		CharacterRange.BasicLatin,
		CharacterRange.Latin1Supplement,
		CharacterRange.LatinExtendedA,
		CharacterRange.Cyrillic
	}
);

SpriteFont font = fontBakeResult.CreateSpriteFont(GraphicsDevice);

Full sample is here: samples/SpriteFontPlus.Samples.TtfBaking

Loading SpriteFont from AngelCode BMFont

string fontData;
using (var stream = TitleContainer.OpenStream("Fonts/test.fnt"))
{
	using (var reader = new StreamReader(stream))
	{
		fontData = reader.ReadToEnd();
	}
}

SpriteFont font = BMFontLoader.Load(fontData, name => TitleContainer.OpenStream("Fonts/" + name), GraphicsDevice);

Full sample is here: samples/SpriteFontPlus.Samples.BMFont

Building From Source Code

  1. Clone this repo.
  2. git submodule update --init --recursive
  3. Open a solution from the "build" folder.

Credits

More Repositories

1

Myra

UI Library for MonoGame, FNA and Stride
C#
726
star
2

Sichem

C to C# Code Converter
C#
89
star
3

FontStashSharp

C# port of https://github.com/memononen/fontstash
C#
75
star
4

StbSharp

C# port of the famous C framework
C#
69
star
5

NvgSharp

C# port of https://github.com/memononen/nanovg
C#
61
star
6

XNAssets

Alternative to MonoGame Content Pipeline that loads raw assets.
C#
27
star
7

Nursia

Lightweight 3D game engine for MonoGame/FNA.
C#
23
star
8

OpenSora

Various experiments with game "Trails in the sky"
C#
17
star
9

DdsKtxSharp

C# port of https://github.com/septag/dds-ktx
C
12
star
10

Jord

"Tales of Jord" is action RPG game influenced by MMORPG SlothMUD.
C#
11
star
11

PerfStat

Widget showing the performance of a MonoGame/FNA app
C#
7
star
12

BlendishSharp

C# port of https://bitbucket.org/duangle/oui-blendish
C#
7
star
13

AssetManagementBase

C#
6
star
14

SamSharp

C# port of https://github.com/s-macke/SAM
C#
6
star
15

SqliteSharp

C# port of sqlite
C
6
star
16

RobotGame

Port of XNA RobotGame Sample to MonoGame/FNA
C#
6
star
17

RacingGame

Port of XNA RacingGame Sample to MonoGame/FNA
C#
6
star
18

MyraTexturePacker

Console Texture Packer Utility
C#
5
star
19

EffectFarm

MonoGame/FNA framework to compile multiple variants of a effect
C#
4
star
20

GdxUBJson

C# Port of UBJson Reader/Writer from LibGDX
C#
4
star
21

AbarimMUD

C# Diku Based MUD Engine
C#
4
star
22

MonoGame.MultiCompileEffects

Multi compile effect support for the Monogame
C#
4
star
23

SealangSharp

SealangSharp is C# port of this: https://github.com/pybee/sealang
C++
4
star
24

Ur

C to Rust Code Converter
C#
3
star
25

DdsKtxXna

MonoGame/FNA library for loading DDS and KTX images.
C#
3
star
26

UfbxSharp

C# Port of https://github.com/ufbx/ufbx
C#
2
star
27

WorldGenerator

FNA/MonoGame Port of https://github.com/jongallant/WorldGeneratorFinal
C#
2
star
28

Myra.Silk.NET

Myra working under Silk.NET
C#
2
star
29

Myra.Extended

Additional functionality for https://github.com/rds1983/Myra
C#
2
star
30

OpenKenshi

Kenshi Resource Viewer
C#
2
star
31

FantasyMapGenerator

C#
1
star
32

FreeTypeSharp

C# Port of freetype
C
1
star
33

FontStashSharp.Silk.NET

FontStashSharp working under Silk.NET
C#
1
star
34

TestOggs

Repository for various oggs to test StbSharp with
1
star
35

DikuLoad

.NET Library To Load DikuMUD Areas
C#
1
star
36

NursiaStudio

Nursia Scene Editor
C#
1
star
37

BibleReader

Every day Bible reader based on the works of Father Daniil Sysoev.
JavaScript
1
star
38

SlothcordBot

TypeScript
1
star
39

stb_rust

Rust port of the famous C framework
C
1
star
40

GltfImporter

Command Line Utility For Converting 3D Models to Glb Format
C#
1
star