Skip to content

LiRenjun-tw/FontVertexBuilder

 
 

Repository files navigation

FontVertexBuilder

Creates triangulated meshes from text font.

Usage

Use PathText to create line path from text font, and use GlyphUtil to create triangulated meshes from line path.

let pathText = PathText.init(
    text: "ABCDE",
    fontName: "AppleSDGothicNeo-Bold",
    fontSize: 10,
    bounds: .zero,
    pivot: .zero,
    textAlignment: .natural,
    verticalAlignment: .center,
    kern: 0,
    lineSpacing: 0,
    isClockwiseFont: true
)
let triangulatedMesh = GlyphUtil.MainFunctions.triangulate(pathText.calculatedPaths, isClockwiseFont: true)

Acknowledgements

Font -> Path algorithms

Original algorithms are from https://github.com/Hi-Rez/Satin. Translated from obj-c code to Swift, and made some modifications. License text is written directly in the source code.

Vector operations on Integer field

Original code is obtained from https://github.com/iShape-Swift/iGeometry. Some modifications are made for convenience. See LICENSE

Triangulation

Original code is obtained from https://github.com/iShape-Swift/iShapeTriangulation. Some modifications are made for convenience. See LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%