Skip to content

Commit

Permalink
Merge pull request #6 from Ed94/alpha-release
Browse files Browse the repository at this point in the history
Alpha release
  • Loading branch information
Ed94 authored Jan 14, 2025
2 parents d329327 + a6a9f62 commit 25e7e87
Show file tree
Hide file tree
Showing 43 changed files with 29,963 additions and 3,339 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/linux_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Linux Build

on:
push:
branches:
- '**'
- '**'
pull_request:
branches:
- '**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Odin
uses: laytan/setup-odin@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up environment
run: |
if ! command -v git &> /dev/null; then
echo "Git not found. Installing Git..."
sudo apt-get update
sudo apt-get install -y git
else
echo "Git is already installed."
fi
git --version
sudo apt-get update
sudo apt-get install -y \
build-essential \
bash \
libfreetype6-dev \
libharfbuzz-dev \
libgl1-mesa-dev \
libx11-dev \
libxcursor-dev \
libxrandr-dev \
libxinerama-dev \
libxi-dev \
libglew-dev \
libxtst-dev \
libasound-dev
make -C "/home/runner/odin/vendor/stb/src"
- name: Run build script
run: |
echo "Setting execute permissions on specific .sh files"
chmod +x ./scripts/build_sokol_demo.sh
chmod +x ./scripts/build_sokol_library.sh
chmod +x ./scripts/compile_sokol_shaders.sh
chmod +x ./scripts/clean.sh
chmod +x ./scripts/helpers/misc.sh
chmod +x ./scripts/helpers/odin_compiler_defs.sh
echo "Running build_sokol_demo.sh"
./scripts/build_sokol_demo.sh
shell: bash

- name: List build artifacts
run: ls -R ./build || echo "build directory not found"

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: linux-build
path: ./build/
if-no-files-found: warn
2 changes: 1 addition & 1 deletion .github/workflows/macos_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
brew install harfbuzz
brew install odin
make -C "/opt/homebrew/Cellar/odin/2024-10/libexec/vendor/stb/src"
make -C "/opt/homebrew/Cellar/odin/2024-12/libexec/vendor/stb/src"
- name: Run build script
run: |
Expand Down
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build
thirdparty
.vscode
# backend/sokol/render_glyph.odin
# backend/sokol/blit_atlas.odin
# backend/sokol/draw_text.odin
.vscode
ols.json
build
thirdparty/freetype
thirdparty/harfbuzz
thirdparty/sokol
thirdparty/sokol-tools
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VEFontCache Odin Port
VEFontCache Odin
Copyright 2024 Edward R. Gonzalez

This project is based on Vertex Engine GPU Font Cache
Expand Down
75 changes: 60 additions & 15 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,73 @@
# VE Font Cache : Odin Port
# VE Font Cache

https://github.com/user-attachments/assets/b74f1ec1-f980-45df-b604-d6b7d87d40ff
Vertex Engine GPU Font Cache: A text shaping & rendering library.

This is a port of the [VEFontCache](https://github.com/hypernewbie/VEFontCache) library.
This project started as a port of the [VEFontCache](https://github.com/hypernewbie/VEFontCache) library to the Odin programming language.
While originally intended for game engines, its rendering quality and performance make it suitable for many other applications.

Its original purpose was for use in game engines, however its rendeirng quality and performance is more than adequate for many other applications.
Since then, the library has been overhauled to offer higher performance, improved visual fidelity, additional features, and quality of life improvements.

See: [docs/Readme.md](docs/Readme.md) for the library's interface.
Features:

* Simple and well documented
* Load and unload fonts at any time
* Almost entirely configurable and tunable at runtime
* Full support for hot-reload
* Clear the caches at any time
* Robust quality of life features:
* Snap positioning to view for better hinting
* Tracks text layers
* Enforce even-only font sizing (useful for linear zoom)
* Push and pop stack for font, font_size, color, view, position, scale, and zoom
* Basic (latin) or advanced (harfbuzz) text shaping
* All rendering is real-time, with triangulation on the CPU, vertex rendering and texture blitting on the GPU
* Can handle thousands of draw text calls with very large or small shapes
* 4-Level Regioned Texture Atlas for caching rendered glyphs
* Text shape caching
* Glyph texture buffer for rendering text with super-sampling to downsample to the atlas or direct to target screen
* Super-sample by a font size scalar for sharper glyphs
* All caching backed by an optimized 32-bit LRU indexing cache
* Provides a backend-agnostic draw list (see [backend](./backend) for usage example)

Upcoming:

* Support choosing between top-left or bottom-left coordinate convention (currently bottom-left)
* Support for better triangulation
* Support for triangulation method selection on a per-font basis
* [Reference paper](https://www.microsoft.com/en-us/research/wp-content/uploads/2005/01/p1000-loop.pdf)
* Better support for tuning glyph render sampling
* Support for sub-pixel AA
* Ability to decide AA method & degree on a per-font basis
* Multi-threading supported job queue
* Lift heavy-lifting portion of the library's context into a thread context
* Synchronize threads by merging their generated layered draw list into a finished draw list for processing on the user's render thread
* User defines how thread contexts are distributed for drawing (a basic quadrant-based selector procedure will be provided)

## Documentation

* [docs/Readme.md](docs/Readme.md) for the library's interface
* [docs/guide_backend.md](docs/guide_backend.md) for information on implementing your own backend
* [docs/guide_architecture.md](docs/guide_architecture.md) for an in-depth breakdown of significant design decisions and code-paths

For learning about text shaping & rendering see: [notes](https://github.com/Ed94/TextRendering_Notes)

## Building

See [scripts/Readme.md](scripts/Readme.md) for building examples or utilizing the provided backends.

Currently the scripts provided & the library itself were developed & tested on Windows. There are bash scripts for building on linux & mac.
Currently, the scripts provided & the library itself were developed & tested on Windows. There are bash scripts for building on Linux (they build on WSL but need additional testing).

The library depends on harfbuzz & stb_truetype to build.
Note: harfbuzz could technically be removed if the user removes their definitions, however this hasn't been made into a conditional compilation option yet.

**NOTICE: All library dependency packages are in the "thirdparty" collection of this repository. For their codebase, the user soley has to modify that collection specification for where they would like to put these external vendor package not provided by the offical Odin vendor collections.**

## Gallery

The library depends on freetype, harfbuzz, & stb_truetype to build.
Note: freetype and harfbuzz could technically be gutted if the user removes their definitions, however they have not been made into a conditional compilation option (yet).
![sokol_demo_2025-01-11_01-32-24](https://github.com/user-attachments/assets/4aea2b23-4362-47e6-b6d1-286e84891702)

## Changes from orignal
https://github.com/user-attachments/assets/db8c7725-84dd-48df-9a3f-65605d3ab444

* Font Parser & Glyph shaper are abstracted to their own warpper interface
* ve_fontcache_loadfile not ported (ust use core:os or os2, then call load_font)
* Macro defines have been coverted (mostly) to runtime parameters
* Support for hot_reloading
* Curve quality step interpolation for glyph rendering can be set on a per font basis.
https://github.com/user-attachments/assets/40030308-37db-492d-a196-f830e8a39f3c

![image](https://github.com/user-attachments/assets/2f6c0b36-179c-42fe-8903-7640ae3c209e)
https://github.com/user-attachments/assets/0985246b-74f8-4d1c-82d8-053414c44aec
Loading

0 comments on commit 25e7e87

Please sign in to comment.