Show HN: GPU-font – match fonts with WebGPU Developer dy released gpu-font, an open-source browser tool that identifies the closest font families to any line of text using WebGPU, published on Hacker News as a Show HN. The tool splits a crop into up to three grayscale windows of at most 128 × 48 px, scores every font per window with a small neural network trained in PyTorch on Google Fonts rendered by Pillow and Chromium, and averages the scores into a ranking. New fonts need no retraining — only a style vector — and the package is installable via `npm install gpu-font` for browser or Node use. Font matching in browser Finds the closest font families to any line of text. Recognition is experimental. Source Model Matches Catalog How it works The crop is split into up to three small grayscale windows. A small neural network scores every font for each window, and the scores are averaged into the ranking. Trained in PyTorch on Google Fonts rendered by Pillow and Chromium; the repository has everything to reproduce it. - Model - – - Input - Up to 3 grayscale windows, at most 128 × 48 px - Catalog - – - Runs on - Starting… - First download - – | Top-1 by source text length | | | |---|---|---| | Characters | Clean | All views | |---|---|---| Accuracy - 1st result - – - Top 5 - – – crops of 5–10 characters in every Google Fonts family, drawn by Chrome, on text it never trained on. Searched in Google Fonts. - 1st result - – - Top 5 - – – photos of a word printed or painted on walls and objects, from WhatFontIs-Bench https://github.com/whatfontis/WhatFontIs-Bench . Searched in all catalogs. - 1st result - – - Top 5 - – – “What font is this?” posts on the DaFont forum https://www.dafont.com/forum/ with an answer the forum confirmed, cropped by hand. Searched in all catalogs. Speed - WebGPU - – - CPU - – Why did it miss my font? The model is still improving. It learned from clean rendered text, so photos, blur, perspective, outlines and textures throw it off, as do one or two letters, mixed fonts and look-alike families. Or the catalogs lack the font. Can it tell weight, italic or width? Weight and italic, yes: each match names its closest face. Width only between families, such as Roboto and Roboto Condensed. Can it find commercial fonts? Only the ones you own. Commercial libraries’ terms mostly forbid collecting their fonts, so the catalogs hold openly licensed ones, and a commercial font gets its closest open look-alikes. Index your own collection ./catalogs.html my-fonts to find the font itself. Does it work beyond Latin? Yes, less reliably. In the top 5: Latin –, Cyrillic –, Arabic –, Chinese –, measured on few non-Latin families so far. Fonts without the detected script’s subset are left out. Does it support handwriting, icons, non-fonts? Not yet. Real handwriting, lettering and logos get only loose matches, and icons and symbols aren’t indexed. Handwriting fonts match like any other font. Do new fonts need retraining? No. A new font needs only its style vector, and fonts it never saw match as well as fonts it trained on. Styles unlike the training data match less well. Can I add my own fonts? Yes: index them on Catalogs ./catalogs.html my-fonts , then choose My fonts in the catalog menu. They stay in your browser. Can I use it from code? Yes, in the browser or Node: npm install gpu-font . The README https://github.com/dy/gpu-font usage shows the API. Alternatives | Matcher | Fonts | Your fonts | Styles | Subsets | Runs on | Open source | Cost | |---|---|---|---|---|---|---|---| | WhatFontIs https://www.whatfontis.com/ WhatFontIs Com SRL | 1,200,000+Free and commercial, many vendors | – | – | Latin | Server | No | 5 a day freePaid PRO | | WhatTheFont https://www.myfonts.com/pages/whatthefont MyFonts | 400,000+ MyFonts https://www.myfonts.com/pages/about | – | – | – | ServerWeb and apps | No | Free | | Font Finder https://font-finder.org/ Owner not stated | 50,000+Web, system and commercial fonts | – | – | – | Windows appServer | No | Free | | Photoshop Match Font https://helpx.adobe.com/photoshop/desktop/text-typography/select-manage-fonts/match-fonts.html Adobe | 30,000+ Adobe Fonts https://fonts.adobe.com/about | Installed | – | Latin, Japanese | Desktop app | No | Subscription | | Lens https://github.com/mixfont/lens Mixfont | 5,000+Google Fonts and other open fonts | – | Weight, italic | – | Local Python, or hosted | Non‑commercial | Free non‑commercialPaid API | | What the Google Font https://www.serbyte.net/what-the-google-font Serbyte Development | 2,000+Google Fonts families | – | – | – | ServerWeb and Chrome extension | No | FreeUnlimited | | Matcherator https://www.fontsquirrel.com/matcherator Font Squirrel | Not stated Font Squirrel, Fontspring, MyFonts https://www.fontsquirrel.com/faq | – | – | – | Server | No | Free | | gpu-font https://github.com/dy/gpu-font dy | –Google Fonts, DaFont and more | Installed, folders ./catalogs.html my-fonts | Weight, italic | – | BrowserWebGPU or CPU | MIT | Free | Licenses No font files ship here: previews load from Google Fonts https://fonts.google.com/ under each family’s license, or are small black-and-white pictures of each font, stored with the site or, for DaFont, loaded from its site, and the catalogs hold only names, links and style numbers. A match is not a license: check a font’s terms with its foundry. Font names are their owners’ trademarks; gpu-font isn’t affiliated with them. The code is MIT-licensed https://github.com/dy/gpu-font/blob/main/LICENSE and comes without warranty.