• Stars
    star
    144
  • Rank 250,176 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created over 5 years ago
  • Updated almost 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#
680
star
2

Sichem

C to C# Code Converter
C#
87
star
3

FontStashSharp

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

StbSharp

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

NvgSharp

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

XNAssets

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

Nursia

Lightweight 3D game engine for MonoGame/FNA.
C#
18
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

SamSharp

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

AssetManagementBase

C#
6
star
15

SqliteSharp

C# port of sqlite
C
5
star
16

MyraTexturePacker

Console Texture Packer Utility
C#
5
star
17

EffectFarm

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

AbarimMUD

C# Diku Based MUD Engine
C#
4
star
19

MonoGame.MultiCompileEffects

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

SealangSharp

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

WorldGenerator

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

Ur

C to Rust Code Converter
C#
2
star
23

Myra.Silk.NET

Myra working under Silk.NET
C#
2
star
24

Myra.Extended

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

GdxUBJson

C# Port of UBJson Reader/Writer from LibGDX
C#
2
star
26

DdsKtxXna

MonoGame/FNA library for loading DDS and KTX images.
C#
2
star
27

UfbxSharp

C# Port of https://github.com/ufbx/ufbx
C#
1
star
28

FantasyMapGenerator

C#
1
star
29

FreeTypeSharp

C# Port of freetype
C
1
star
30

FontStashSharp.Silk.NET

FontStashSharp working under Silk.NET
C#
1
star
31

TestOggs

Repository for various oggs to test StbSharp with
1
star
32

NursiaStudio

Nursia Scene Editor
C#
1
star
33

BibleReader

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

SlothcordBot

TypeScript
1
star
35

stb_rust

Rust port of the famous C framework
C
1
star
36

OpenKenshi

Kenshi Resource Viewer
C#
1
star