Prowl.Scribe
0.7.5
dotnet add package Prowl.Scribe --version 0.7.5
NuGet\Install-Package Prowl.Scribe -Version 0.7.5
<PackageReference Include="Prowl.Scribe" Version="0.7.5" />
<PackageVersion Include="Prowl.Scribe" Version="0.7.5" />
<PackageReference Include="Prowl.Scribe" />
paket add Prowl.Scribe --version 0.7.5
#r "nuget: Prowl.Scribe, 0.7.5"
#:package Prowl.Scribe@0.7.5
#addin nuget:?package=Prowl.Scribe&version=0.7.5
#tool nuget:?package=Prowl.Scribe&version=0.7.5
<img src="Samples/RaylibTest/ProwlLogo.png" width="100%" alt="Scribe logo image">
Scribe is under active development. APIs may change and it hasn't yet proven itself in production.
<p align="center">Join our Discord server! 🎉</p>
<p align="center">A Fast & Flexible Font System for .NET</p>
<p align="center">📚 Documentation: Coming Soon 📚</p>
<span id="readme-top"></span>
<p align="center">Table of Contents</p>
<span align="center">📝 About The Project 📝</span>
Scribe is an open-source, MIT-licensed TrueType font parser and rasterizer for .NET. It powers text rendering in the Prowl game engine but is designed to work in any environment that can provide an IFontRenderer
.
<span align="center">✨ Features ✨</span>
- TrueType font parsing and glyph rasterization
- Font Families
- Dynamic atlas packing with optional expansion
- Flexible text layout engine with cursor hit testing
- Lightweight Markdown parser and layout engine
- Pluggable rendering backend through
IFontRenderer
- Optional layout caching with LRU eviction
- TTF Loader and Rasterizer Based Upon STBTrueType
- Unicode codepoint mapping, full glyph metrics (advance, bearings, bounds, vertical metrics) and kerning pairs
- Extracts glyph outlines and rasterizes to 8-bit alpha bitmaps
<span align="center">🚀 Getting Started 🚀</span>
Installation
Add the package via NuGet:
dotnet add package Prowl.Scribe
Basic Usage
var renderer = new MyFontRenderer(); // implements IFontRenderer
var scribe = new FontSystem(renderer);
// Load fonts, Will load all System Fonts with the passed FontFamilies as Priority
scribe.LoadSystemFonts("Arial");
// or: var font = scribe.AddFont(File.ReadAllBytes("path/to/font.ttf"));
// If you use SystemFonts its recommended to add priorities also for different platforms
// Not all operating systems have the same fonts. This is the priority list used in the Samples:
// "Segoe UI", "Arial", "Liberation Sans", "Consola", "Menlo", "Liberation Mono"
// Draw text will attempt to use preferredFont if available
var preferredFont = scribe.GetFont(fontFamily, FontStyle.Bold);
scribe.DrawText("Hello World!", position, FontColor.Blue, pixelSize, preferredFont)
Markdown Rendering
var imageProvider = new MyImageProvider(); // implements IMarkdownImageProvider
// Get the fonts you would like the Markdown rendering to use
var font = fs.GetFont("Arial", FontStyle.Regular);
var mono = fs.GetFont("Consolas", FontStyle.Regular);
var bold = fs.GetFont("Arial", FontStyle.Bold);
var italic = fs.GetFont("Arial", FontStyle.Italic);
var boldItalic = fs.GetFont("Arial", FontStyle.BoldItalic);
// Create the markdown Settings
var settings = MarkdownLayoutSettings.Default(font, mono, bold, italic, boldItalic, width: 400);
// Parse your Markdown
var document = Markdown.Parse(YourMarkdown);
// Layout the markdown (relative to 0,0)
var markdownLayout = MarkdownLayoutEngine.Layout(document, scribe, settings, imageProvider);
// Render your Markdown at the specified position
MarkdownLayoutEngine.Render(markdownLayout, scribe, renderer, position, settings);
// You can also check if the mouse cursor is hovering over a Clickable Link!
bool isMouseOverLink = MarkdownLayoutEngine.TryGetLinkAt(markdownLayout, mouse, position, out var href);
<span align="center">🤝 Contributing 🤝</span>
Contributions, issues and feature requests are welcome! Feel free to fork this repository and submit a pull request.
<span align="center">📄 License 📄</span>
Distributed under the MIT License. See LICENSE for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Prowl.Scribe:
Package | Downloads |
---|---|
Prowl.Quill
A Hardware-Accelerated Anti-Aliased Vector Graphics Library made with .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.