Custom text rendering engine for OLED displays. Replaces Windows ClearType system-wide via DLL injection.
ClearType was designed for LCD panels with a fixed RGB stripe. On OLEDs where subpixels are physically different shapes, sizes, and arrangements, it produces visible color fringing and washed-out stems. PureType fixes this by intercepting GDI and DirectWrite calls and re-rendering text with panel-aware subpixel filtering.
- Hooks
ExtTextOutW(GDI) andIDWriteTextLayout::Draw(DirectWrite) in target processes - Rasterizes glyphs with FreeType in LCD mode (3× horizontal resolution)
- Applies HVS-optimized convolution kernels designed for the actual subpixel geometry of your panel
- Blends to screen in linear light using IEC 61966-2-1 sRGB transfer functions
- Applies stem darkening to restore font weight lost when ClearType's RGB sub-sampling is removed
LG WOLED (RWBG / RGWB) — Handles the non-standard subpixel ordering and the addition of the White subpixel. Uses a 1x7 FIR filter in linear space. The algorithm applies "TCON Inversion Math": it injects the calculated white energy into the RGB channels using a mathematical maximum before transmission, allowing the monitor's internal hardware to correctly extract the White subpixel without energy clipping or color fringing.
Samsung QD-OLED (Triangle/Diamond) — Addresses the severe color fringing caused by the delta-grid arrangement of QD-OLEDs. It applies specific fractional phase-shifting directly at the FreeType rasterization level, followed by a 1x5 FIR filter. It heavily utilizes the Perceptual Tone Mapper to apply Chroma Crushing (desaturating color artifacts on text edges) and an aggressive S-Curve Readability Tone to counter the "washed-out" effect caused by the large black gaps (fill-factor) in the QD-OLED matrix.
- Injection:
puretype.exeforces Windows to loadPureType.dllinto target processes viaSetWindowsHookEx(WH_CBT). - Hooking: MinHook intercepts
ExtTextOutW(GDI) andIDWriteTextLayout::Draw(DirectWrite), checking against a rigorous blacklist to avoid crashing sandboxed apps. - Phase-Aware Rasterization: FreeType renders the glyphs at 3× horizontal resolution. The rasterizer dynamically shifts the vector outlines (phase) based on the physical pixel grid of the target OLED panel.
- Subpixel Filtering: FIR low-pass filters distribute the geometric coverage in strictly linear light, calculating exact light emission values for each subpixel.
- Perceptual Tone Mapping:
- Chroma Crushing: Detects subpixel imbalances on high-contrast edges and pushes them towards neutral grays, eliminating the purple/green OLED fringing.
- Readability Tone: Applies a dynamic power exponent to inflate the text stems based on font size and the
LumaContrastStrengthsetting.
- Compositing: The final RGBA buffer is alpha-blended over the application's background using mathematically
correct linear-space compositing via D2D or GDI
BitBlt.
Requires Visual Studio 2022 Build Tools and CMake. FreeType and MinHook are fetched automatically.
cmake -S . -B build -G "Visual Studio 17 2022" -A x64
cmake --build build --config Release
Output lands in build/Release/:
puretype.exe— system tray loaderPureType.dll— the rendering enginepuretype.ini— configuration
Put all three files in the same folder. Run puretype.exe — ideally as Administrator for full system-wide coverage. A
tray icon appears.
Right-click the tray icon to:
- Enable / Disable the hook (toggle injection on/off)
- Panel Type → pick your display (LG WRGB or Samsung QD-OLED)
- Exit
Panel choice is saved to puretype.ini and persists across restarts.
The DLL auto-skips processes where injection would cause problems: system services (csrss, lsass, dwm), anti-cheat
software (Vanguard, EAC, BattlEye), games with integrity checks, and browsers with strict sandboxes.
UWP apps (Calculator, Settings, the new Notepad) work out of the box — the injector automatically grants AppContainer read permissions on the DLL before setting the hook.
Edit puretype.ini:
QD-OLED
[General]
PanelType = QD_OLED_TRIANGLE
FilterStrength = 1.0
Gamma = 1.0
EnableSubpixelHinting = true
EnableFractionalPositioning = true
LODThresholdSmall = 12.0
LODThresholdLarge = 24.0
WOLEDCrossTalkReduction = 0.0
LumaContrastStrength = 1.25
StemDarkeningEnabled = true
StemDarkeningStrength = 0.35RWBG
[General]
PanelType = RWBG
FilterStrength = 1.0
Gamma = 1.0
EnableSubpixelHinting = true
EnableFractionalPositioning = true
LODThresholdSmall = 12.0
LODThresholdLarge = 24.0
WOLEDCrossTalkReduction = 0.12
LumaContrastStrength = 1.45
StemDarkeningEnabled = true
StemDarkeningStrength = 0.45RGWB
[General]
PanelType = RGWB
FilterStrength = 1.0
Gamma = 1.0
EnableSubpixelHinting = true
EnableFractionalPositioning = true
LODThresholdSmall = 12.0
LODThresholdLarge = 24.0
WOLEDCrossTalkReduction = 0.10
LumaContrastStrength = 1.40
StemDarkeningEnabled = true
StemDarkeningStrength = 0.45Gamma is not the display gamma — it's an optional exponent applied on top of the sRGB transfer curve. Leave it at
1.0 unless you have a specific reason to change it.
puretype.execallsSetWindowsHookEx(WH_CBT)pointing at an exported callback inPureType.dll- Windows automatically loads
PureType.dllinto every process that creates a window - On load, the DLL checks the host process against a blacklist — if matched, it bails immediately
- Otherwise it initializes FreeType, installs MinHook detours on GDI/DirectWrite text functions
- When the app renders text, PureType intercepts the call, rasterizes with FreeType LCD mode, runs the subpixel filter, and composites to screen
The subpixel filter pipeline:
- Convert FreeType's LCD bitmap from sRGB to linear light (LUT, 256 entries)
- Apply per-channel convolution kernel (panel-specific, HVS-weighted)
- Stem darkening:
coverage = 1 - (1 - c)^(1 + boost)— heavy at thin strokes, near-zero at solid fills - Convert back to sRGB (LUT, 4097 entries with linear interpolation)
- Alpha-blend against the background in linear space
- FreeType — glyph rasterization (fetched by CMake)
- MinHook — API hooking (fetched by CMake)
- Direct2D, DirectWrite, GDI32 — Windows platform APIs
GNU GPLv3
Support me: https://paypal.me/masterantonio
