Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0ca8b62
Replace arc API with quadratic Bezier curve accumulator
behdad Mar 21, 2026
2d88133
Add band builder and blob encoder for Slug-style rendering
behdad Mar 21, 2026
bd082fb
Add Slug pixel shader (GLSL 1.30 port) and update build
behdad Mar 21, 2026
b6fc50d
Add demo vertex/fragment shaders and update data structures
behdad Mar 21, 2026
c1658ef
Wire up demo for Slug-style rendering
behdad Mar 21, 2026
1a7695c
Fix demo buffer size for complex glyphs
behdad Mar 21, 2026
6080bde
Fix shader compilation: require GLSL 3.30, remove stale headers
behdad Mar 21, 2026
766b3ac
Remove old arc/SDF pipeline and unused files
behdad Mar 21, 2026
f9ab1b0
Fix missing close_path and band boundary precision
behdad Mar 21, 2026
11e61e2
[meson] Adjust glut finding
behdad Mar 21, 2026
9e87d56
Fix float32 precision: encode lines as (p1,p1,p3) quadratics
behdad Mar 21, 2026
684c80e
Increase quantization precision to 4 units per em unit
behdad Mar 21, 2026
859bf0e
Remove dead demo code for boldness, contrast, gamma, outline, debug
behdad Mar 21, 2026
1803aa3
Switch atlas from 2D texture to buffer texture (TBO)
behdad Mar 21, 2026
81f74e6
Move band transform into blob header, simplify client API
behdad Mar 21, 2026
68b1110
Shrink per-vertex data: ivec4 -> single uint glyphLoc
behdad Mar 21, 2026
3076260
Remove autotools build, add .gitignore for generated files
behdad Mar 21, 2026
7888f9a
Keep extents and advance in font units, drop normalization round-trip
behdad Mar 21, 2026
6440806
Share endpoints between adjacent curves in contour
behdad Mar 21, 2026
1dcbbc8
Update CI: meson only, Ubuntu 24.04, drop harfbuzz build
behdad Mar 21, 2026
66d32d3
Add symmetric band optimization
behdad Mar 21, 2026
8eb14a3
Cleanup: remove win32 build, unused MIN_FONT_SIZE, fix CI apt
behdad Mar 21, 2026
70aef1b
Per-band optimal split value for symmetric optimization
behdad Mar 21, 2026
6660245
Add dynamic dilation in vertex shader
behdad Mar 21, 2026
563964e
Move dilation to library vertex shader, rename shader API
behdad Mar 21, 2026
c99c8ed
Fix Slug attribution, remove shader _path APIs
behdad Mar 21, 2026
9b136b3
Update README for Slug-based renderer, remove empty NEWS
behdad Mar 21, 2026
9350673
Remove dead android build
behdad Mar 21, 2026
de35e77
Remove stale autotools files, update pkg-config description
behdad Mar 21, 2026
dca7985
Update copyright headers, remove inline Apache license text
behdad Mar 21, 2026
b219cc6
Require OpenGL 3.3 and guard blob int16 metadata
behdad Mar 21, 2026
7437174
Make glyph dilation perspective-aware
behdad Mar 21, 2026
cecd89b
Require GLEW when building the demo
behdad Mar 21, 2026
42d588e
Remove dead demo compatibility code
behdad Mar 21, 2026
1a26351
Reuse demo glyph scratch buffer on the heap
behdad Mar 21, 2026
d9f9a33
Print demo controls and drop startup traces
behdad Mar 21, 2026
1be1853
Add demo help shortcuts
behdad Mar 21, 2026
d4a1aaa
Add demo sRGB toggle shortcut
behdad Mar 21, 2026
e80c8ee
Log demo animation state changes
behdad Mar 21, 2026
2993690
meson: link OpenGL framework for macOS demo
behdad Mar 21, 2026
a93b6f1
Revert "meson: link OpenGL framework for macOS demo"
behdad Mar 21, 2026
b6e01e5
Request sRGB window and clean up demo toggles
behdad Mar 21, 2026
2ecf251
Warn about GNOME vsync overrides
behdad Mar 21, 2026
9dec181
meson: use Apple GL frameworks on macOS
behdad Mar 21, 2026
4dbed0a
demo: request core profile on macOS
behdad Mar 21, 2026
8a25f87
demo: bind a VAO for core profile
behdad Mar 21, 2026
a736fd7
demo: detect sRGB framebuffer in core profile
behdad Mar 21, 2026
5e23b6d
demo: port from GLUT to GLFW
behdad Mar 21, 2026
2127d48
demo: fix GLEW init with core profile
behdad Mar 21, 2026
1262b09
demo: fix HiDPI support with GLFW
behdad Mar 21, 2026
f495ada
demo: fix first-frame blurriness on Wayland HiDPI
behdad Mar 21, 2026
ddaa6f1
demo: fix mouse jump on first drag
behdad Mar 21, 2026
8782018
demo: use double-precision timing for smooth animation
behdad Mar 21, 2026
b5437ed
demo: use GLFW sRGB capability hint
behdad Mar 21, 2026
74b934a
demo: probe sRGB by toggling framebuffer state
behdad Mar 21, 2026
d3983b2
Rename demo shaders to vertex and fragment
behdad Mar 21, 2026
1e13881
Abort on unsupported cubic outlines
behdad Mar 21, 2026
29e6f4d
Report atlas usage in demo stats
behdad Mar 21, 2026
306534d
Add bench-encode font benchmark
behdad Mar 21, 2026
97d35d6
Set default Meson buildtype to debugoptimized
behdad Mar 21, 2026
47239a8
Cache curve bounds during blob encoding
behdad Mar 21, 2026
09ad9f2
Reduce band-list allocation churn in blob encoder
behdad Mar 21, 2026
726f39a
Make band split selection linear-time
behdad Mar 21, 2026
18fceba
Fold extents computation into encoder preprocessing
behdad Mar 21, 2026
0c7ada9
Cache band ranges during encoder preprocessing
behdad Mar 21, 2026
1ed8329
Flatten band index storage in blob encoder
behdad Mar 21, 2026
ea69633
Add reusable glyph encoder object
behdad Mar 21, 2026
102cd52
Merge branch 'master' into slug
behdad Mar 21, 2026
fb65234
Add Eric to copyright holders for the Slug shaders
behdad Mar 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 3 additions & 26 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,12 @@ on:

jobs:
build-test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Cache Harfbuzz
uses: actions/cache@v3
with:
path: harfbuzz-7.3.0
key: ${{ runner.os }}-build
- uses: actions/checkout@v4
- name: Install build dependencies
run: sudo apt install -y curl gcc g++ libfreetype6-dev libglib2.0-dev libcairo2-dev make cmake automake autoconf libtool libharfbuzz-dev meson freeglut3-dev libglew-dev
- name: Download a recent harfbuzz archive
# TODO: Ubuntu 22.04 has harfbuzz < 4.0.0. Ubuntu 24.04 will have harfbuzz >= 4.0.0.
# The harfbuzz build will not be required when Github updates the runners.
run: curl -L https://github.com/harfbuzz/harfbuzz/releases/download/7.3.0/harfbuzz-7.3.0.tar.xz -O
- name: Decompress harfbuzz archive
run: tar xvf harfbuzz-7.3.0.tar.xz
- name: Configure harfbuzz build
run: cd harfbuzz-7.3.0; meson setup build
- name: Build harfbuzz
run: cd harfbuzz-7.3.0; meson compile -C build
- name: Install harfbuzz
run: cd harfbuzz-7.3.0; sudo meson install -C build
- name: Configure glyphy
run: ./autogen.sh
- name: Make glyphy
run: make
run: sudo apt update && sudo apt install -y gcc g++ libfreetype6-dev libharfbuzz-dev meson freeglut3-dev libglew-dev
- name: Meson setup
run: meson setup build
- name: Meson compile
run: meson compile -C build
- name: Run Validator against default font
run: ./demo/glyphy-validate ./demo/default-font.ttf
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build/
*.o
*~
.*.sw[nop]
*-glsl.h
default-font.h
default-text.h
1 change: 1 addition & 0 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ GLyphy is licensed under the so-called "Old MIT" license, since HarfBuzz
has standardized around this license:

Copyright 2012 The GLyphy Project Authors
Copyright 2017 by Eric Lengyel

Permission is hereby granted, without written agreement and without
license or royalty fees, to use, copy, modify, and distribute this
Expand Down
30 changes: 0 additions & 30 deletions Makefile.am

This file was deleted.

1 change: 0 additions & 1 deletion NEWS

This file was deleted.

58 changes: 30 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
GLyphy is a signed-distance-field (SDF) text renderer using OpenGL ES2 shading language.
GLyphy is a GPU text renderer that renders glyph outlines directly,
using the [Slug algorithm](https://jcgt.org/published/0006/02/02/)
by Eric Lengyel for robust winding number calculation.

The main difference between GLyphy and other SDF-based OpenGL renderers is that most other projects sample the SDF into a texture. This has all the usual problems that sampling has. Ie. it distorts the outline and is low quality.
GLyphy works with quadratic Bezier curves (TrueType outlines) and
produces pixel-perfect rendering at any scale with proper antialiasing.

GLyphy instead represents the SDF using actual vectors submitted to the GPU. This results in very high quality rendering, though at a much higher runtime cost.
## Building

See this video for insight to how GLyphy works:
Requires: meson, OpenGL 3.3+, FreeType, HarfBuzz, GLUT, GLEW.

http://vimeo.com/behdad/glyphy
```sh
meson setup build
meson compile -C build
build/demo/glyphy-demo
```

Dicussions happen on:
## How it works

https://groups.google.com/forum/#!forum/glyphy
Each glyph's outline is encoded into a compact blob stored in a GPU
buffer texture. The fragment shader computes a winding number by
casting horizontal and vertical rays against the quadratic Bezier
curves, using Lengyel's equivalence class algorithm for numerical
robustness. Curves are organized into bands for efficient early exit.

----------------------------------------------------------------------
The vertex shader performs dynamic dilation to ensure edge pixels
are always shaded for antialiasing.

On GNOME3 and possibly other systems, if the vsync extension is not working (ie. pressing `v` in the demo doesn't have any effect), try running with `vblank_mode=0` env var.
Unlike Slug's reference vertex path, GLyphy computes dilation from
the projective Jacobian of NDC with respect to glyph-plane position
while using its existing quad vertex format, so the half-pixel
expansion remains perspective-aware.

### Compilation instructions on Mac OS X
## Notes

1. Install Xcode and command line tools (as of Xcode 4.3.x, from
  within `Preferences` -> `Downloads`).
2. Install [MacPorts](https://www.macports.org/install.php).
3. `sudo port install automake autoconf libtool pkgconfig freetype`
4. `./autogen.sh`
5. `make`
On GNOME3 and possibly other systems, if the vsync extension is not
working (pressing `v` in the demo has no effect), try running with
`vblank_mode=0`.

### Compilation instructions on Windows
## License

See [appveyor.yml](https://github.com/behdad/glyphy/blob/master/appveyor.yml), basically first get [vcpkg](https://github.com/Microsoft/vcpkg) and install `glew`, `freetype` and `freeglut` on it, then open win32\glyphy.sln
with Visual Studio.

### Compilation instructions for emscripten

Assuming you have installed emscripten and have its tools on path,

1. `NOCONFIGURE=1 ./autogen.sh`
2. `CPPFLAGS='-s USE_FREETYPE=1' LDFLAGS='-s USE_FREETYPE=1' emconfigure ./configure`
3. `make EXEEXT=.html GL_LIBS= GLUT_LIBS=`
4. The result will be located on `demo/.libs/glyphy-demo.html` (not `demo/glyphy-demo.html`)
GLyphy is licensed under the Apache License, Version 2.0.
27 changes: 0 additions & 27 deletions ac_define_dir.m4

This file was deleted.

1 change: 0 additions & 1 deletion acinclude.m4

This file was deleted.

11 changes: 0 additions & 11 deletions appveyor.yml

This file was deleted.

29 changes: 0 additions & 29 deletions autogen.sh

This file was deleted.

Loading