<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hazel Fenwick</title>
    <description>The latest articles on DEV Community by Hazel Fenwick (@hazelfenwick).</description>
    <link>https://dev.to/hazelfenwick</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4272484%2Ff29c35df-3354-43e0-a541-247407c16f6d.png</url>
      <title>DEV Community: Hazel Fenwick</title>
      <link>https://dev.to/hazelfenwick</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hazelfenwick"/>
    <language>en</language>
    <item>
      <title>Logo File Formats Explained (2026): SVG, CMYK EPS, 300-DPI Print PDF, Clearspace Specs, and Ownership Basics</title>
      <dc:creator>Hazel Fenwick</dc:creator>
      <pubDate>Wed, 02 Dec 2026 16:52:26 +0000</pubDate>
      <link>https://dev.to/hazelfenwick/logo-file-formats-explained-2026-svg-cmyk-eps-300-dpi-print-pdf-clearspace-specs-and-2gd9</link>
      <guid>https://dev.to/hazelfenwick/logo-file-formats-explained-2026-svg-cmyk-eps-300-dpi-print-pdf-clearspace-specs-and-2gd9</guid>
      <description>&lt;p&gt;Every small business eventually hits the same production wall: the PNG logo that looked sharp inside a pitch deck turns blurry on a business card, gets rejected by an embroidery vendor, or triggers a "missing font" warning at a local print shop.&lt;/p&gt;

&lt;p&gt;The fix is straightforward once you map each real-world channel to the exact file specification it requires. Here is the plain-English 2026 logo file format reference we built into &lt;a href="https://www.logonib.com/guides/best-logo-file-formats-for-websites-and-print" rel="noopener noreferrer"&gt;LogoNib's Best Logo File Formats Guide&lt;/a&gt;, plus two new free browser utilities for typography pairing and clearspace guidelines.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The 7 Logo File Formats — Where Each One Actually Belongs
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Format&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Best Used For&lt;/th&gt;
&lt;th&gt;Why Print Shops &amp;amp; Platforms Care&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Outlined SVG&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vector (&lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Website headers, Shopify, Webflow, Squarespace, app UI, source archive&lt;/td&gt;
&lt;td&gt;Infinite zoom sharpness, tiny file size, zero missing-font substitution when text is converted to vector curves.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CMYK EPS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vector (PostScript)&lt;/td&gt;
&lt;td&gt;Screen printing, vinyl signage, promo merch, legacy Adobe Illustrator &amp;amp; embroidery digitizers&lt;/td&gt;
&lt;td&gt;Native device CMYK color values and pure vector paths accepted by nearly every US print workflow.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;300-DPI Print PDF&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vector + Bleed&lt;/td&gt;
&lt;td&gt;Business cards, letterheads, packaging, brochures, Vistaprint &amp;amp; Moo uploads&lt;/td&gt;
&lt;td&gt;Preserves vector edges alongside physical inch dimensions, 0.125" bleed margins, and trim crop marks.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Transparent PNG&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Raster (Lossless)&lt;/td&gt;
&lt;td&gt;Social profiles, pitch decks, email signatures, watermark overlays, Canva/Notion docs&lt;/td&gt;
&lt;td&gt;Universal compatibility with alpha transparency — export at 2048px–4096px wide so it never pixelates.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Multi-Size ICO&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Icon Container&lt;/td&gt;
&lt;td&gt;Browser tabs, bookmarks, desktop shortcuts&lt;/td&gt;
&lt;td&gt;Packs crisp 16×16, 32×32, and 48×48 icons alongside &lt;code&gt;apple-touch-icon.png&lt;/code&gt; for iOS home screens.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;WebP&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Raster (Modern Web)&lt;/td&gt;
&lt;td&gt;Fast blog embeds, OG social cards, hero lockups where SVG isn't accepted&lt;/td&gt;
&lt;td&gt;Smaller payload than PNG with alpha transparency support across modern browsers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;JPG&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Raster (Lossy)&lt;/td&gt;
&lt;td&gt;Never as a primary logo master&lt;/td&gt;
&lt;td&gt;No transparency and visible compression halos around crisp text edges.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  2. Outlined SVG vs. Live-Text SVG (The #1 Print Rejection Cause)
&lt;/h2&gt;

&lt;p&gt;Opening an &lt;code&gt;.svg&lt;/code&gt; file in a text editor and finding &lt;code&gt;&amp;lt;text font-family="Montserrat"&amp;gt;&lt;/code&gt; means that file depends on the recipient's computer having that exact font installed. Send it to a commercial printer, sign maker, or contractor without that font, and Illustrator silently swaps in Arial or Myriad Pro — ruining your kerning and brand mark.&lt;/p&gt;

&lt;p&gt;A production master SVG converts every glyph into mathematical Bézier &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; outlines (the exact approach we use with &lt;code&gt;opentype.js&lt;/code&gt; in LogoNib). You can audit any existing SVG locally in your browser with our free &lt;a href="https://www.logonib.com/tools/svg-font-outline-checker" rel="noopener noreferrer"&gt;SVG Font Outline Checker&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Clearspace, Minimum Print Sizes, and Brand Typography Sheets
&lt;/h2&gt;

&lt;p&gt;Handing a developer or printer just a logo file is only half the handoff. Without clearspace rules and paired typography, your mark ends up crammed against webpage borders, stretched out of proportion, or paired with mismatched system fonts.&lt;/p&gt;

&lt;p&gt;We just shipped two new free client-side tools — bringing the &lt;a href="https://www.logonib.com/tools" rel="noopener noreferrer"&gt;LogoNib Free Vector Suite&lt;/a&gt; to &lt;strong&gt;20 zero-signup browser utilities&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/logo-size-guidelines" rel="noopener noreferrer"&gt;Logo Size, Clearspace &amp;amp; Safe-Zone Spec Generator&lt;/a&gt;:&lt;/strong&gt; Upload any PNG, JPG, WebP, or SVG logo locally to calculate exact &lt;code&gt;0.25X&lt;/code&gt;, &lt;code&gt;0.5X&lt;/code&gt;, or &lt;code&gt;1.0X&lt;/code&gt; clearspace margins, minimum print width (&lt;code&gt;0.75"&lt;/code&gt; / &lt;code&gt;1.0"&lt;/code&gt;) and web height (&lt;code&gt;24px&lt;/code&gt; / &lt;code&gt;32px&lt;/code&gt;), and 12 aspect-ratio-locked dimensions across websites, avatars, business cards, embroidery, and signage — plus a 1-page printable &lt;strong&gt;US Letter Logo Size &amp;amp; Clearspace Guidelines PDF&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/logo-font-pairing" rel="noopener noreferrer"&gt;Logo Font Pairing &amp;amp; Brand Typography Specimen Lab&lt;/a&gt;:&lt;/strong&gt; Audition 10 commercial brand typography pairings across website headers, 3.5"×2" business cards, dark-mode monograms, and mobile screens, adjust tracking and ink colors live, copy CSS Variables or Tailwind v4 &lt;code&gt;@theme&lt;/code&gt; tokens, and export a printable &lt;strong&gt;US Letter Brand Typography Specimen PDF&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  4. Copyright &amp;amp; Trademark Preparation: Watch Out for Stock Template Traps
&lt;/h2&gt;

&lt;p&gt;Before printing signage or filing a USPTO trademark application, verify what rights your logo tool actually grants. Many free template editors rely on shared stock icons that explicitly prohibit exclusive trademark claims, while subscription logo makers lock vector downloads and edit access behind recurring monthly renewals.&lt;/p&gt;

&lt;p&gt;We published a plain-English design and file-preparation guide covering copyright vs. USPTO trademark basics and the exact artwork files (black-and-white vector mark, outlined SVG/EPS, HEX/CMYK color spec) founders prepare for USPTO TEAS or trademark counsel: &lt;a href="https://www.logonib.com/guides/how-to-trademark-and-copyright-a-logo-us" rel="noopener noreferrer"&gt;How to Trademark and Copyright a Logo in the US&lt;/a&gt;. &lt;em&gt;(Informational file-preparation guide, not legal advice.)&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Explore the Full Suite
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;All 20 Free Browser-Native Vector &amp;amp; Print Tools:&lt;/strong&gt; &lt;a href="https://www.logonib.com/tools" rel="noopener noreferrer"&gt;https://www.logonib.com/tools&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All 7 Brand &amp;amp; Print Field Guides:&lt;/strong&gt; &lt;a href="https://www.logonib.com/guides" rel="noopener noreferrer"&gt;https://www.logonib.com/guides&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LogoNib Studio (6 Free Vector Concepts, One-Time Packs $29 / $49 / $89 — Zero Subscriptions):&lt;/strong&gt; &lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;https://www.logonib.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>design</category>
      <category>svg</category>
      <category>webdev</category>
      <category>branding</category>
    </item>
    <item>
      <title>Building a Pure-TypeScript ISO/IEC 18004 QR Code Generator with Outlined SVG and Print-Ready CMYK EPS</title>
      <dc:creator>Hazel Fenwick</dc:creator>
      <pubDate>Wed, 02 Dec 2026 16:16:36 +0000</pubDate>
      <link>https://dev.to/hazelfenwick/building-a-pure-typescript-isoiec-18004-qr-code-generator-with-outlined-svg-and-print-ready-cmyk-40lm</link>
      <guid>https://dev.to/hazelfenwick/building-a-pure-typescript-isoiec-18004-qr-code-generator-with-outlined-svg-and-print-ready-cmyk-40lm</guid>
      <description>&lt;p&gt;Most "free" QR code websites follow the same bait-and-switch pattern: they generate a dynamic redirect URL pointing to their own tracking domain, let you print 5,000 business cards or product labels, and then deactivate the QR code 14 days later unless you start paying $15 to $49 per month.&lt;/p&gt;

&lt;p&gt;Even the genuinely free generators almost always export low-resolution PNGs — or SVGs composed of 1,500 individual &lt;code&gt;&amp;lt;rect&amp;gt;&lt;/code&gt; elements that render hairline anti-aliasing seams between adjacent black modules in PDF viewers, Adobe Illustrator, and commercial print RIPs.&lt;/p&gt;

&lt;p&gt;For &lt;a href="https://www.logonib.com/tools/qr-code-logo-generator" rel="noopener noreferrer"&gt;LogoNib's free Static Vector QR Code Generator&lt;/a&gt;, we built a zero-dependency ISO/IEC 18004 encoder directly in TypeScript (&lt;code&gt;src/lib/logo/qr.ts&lt;/code&gt;) that runs 100% client-side in the browser and exports:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Outlined &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt;-only SVG&lt;/strong&gt; with horizontally merged dark runs (zero hairline seams, zero fonts, zero external assets).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Print-ready CMYK PostScript EPS (&lt;code&gt;%!PS-Adobe-3.0 EPSF-3.0&lt;/code&gt;)&lt;/strong&gt; via our browser-native SVG-to-EPS encoder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2048×2048 PNG&lt;/strong&gt; with optional center logo compositing inside an automatically calculated ECC Level H safe window.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is how the math, geometry, and security sanitization work under the hood.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Deterministic ISO/IEC 18004 Encoding in GF(256)
&lt;/h2&gt;

&lt;p&gt;A QR code is a Reed-Solomon error-corrected bit matrix operating over the finite field $\text{GF}(2^8)$ with primitive polynomial $x^8 + x^4 + x^3 + x^2 + 1$ (&lt;code&gt;0x11D&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Instead of pulling in an opaque WASM binary or third-party server API, our encoder handles every stage deterministically in ~800 lines of TypeScript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Version selection (Versions 1–10):&lt;/strong&gt; UTF-8 encodes the payload (&lt;code&gt;URL&lt;/code&gt;, &lt;code&gt;vCard 3.0&lt;/code&gt;, &lt;code&gt;WIFI:&lt;/code&gt;, &lt;code&gt;mailto:&lt;/code&gt;, or &lt;code&gt;tel:&lt;/code&gt;) in Byte Mode (&lt;code&gt;0100&lt;/code&gt;), picks the smallest ISO/IEC 18004 Table 9 version that fits the payload at the selected Error Correction Level (&lt;code&gt;L&lt;/code&gt;, &lt;code&gt;M&lt;/code&gt;, &lt;code&gt;Q&lt;/code&gt;, or &lt;code&gt;H&lt;/code&gt;), pads the data stream with alternating &lt;code&gt;0xEC&lt;/code&gt; / &lt;code&gt;0x11&lt;/code&gt; bytes, and splits codewords across Group 1 and Group 2 blocks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reed-Solomon generator polynomials:&lt;/strong&gt; Precomputes &lt;code&gt;GF_EXP&lt;/code&gt; and &lt;code&gt;GF_LOG&lt;/code&gt; lookup tables in &lt;code&gt;GF(256)&lt;/code&gt; to divide each data block by the exact generator polynomial for that version's &lt;code&gt;ecPerBlock&lt;/code&gt; count, then interleaves data and EC codewords per spec.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Function patterns &amp;amp; 8-mask penalty scoring:&lt;/strong&gt; Places finder patterns, separators, timing tracks, alignment patterns, dark module, and BCH-encoded format/version information bits — then evaluates all 8 ISO/IEC 18004 data masks against the 4 standard penalty rules (consecutive runs, 2×2 blocks, finder-like &lt;code&gt;1:1:3:1:1&lt;/code&gt; patterns, and dark/light balance) to pick the cleanest, easiest-to-scan matrix.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Center Logo Cutout Geometry &amp;amp; Automatic ECC Level H Lock
&lt;/h2&gt;

&lt;p&gt;Placing a brand icon in the center of a QR code is the fastest way to break scan reliability if done blindly. At ECC Level L (7% recovery), even a small badge can push damaged codewords over the recovery threshold.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;generateQrMatrix(payload, { centerBadge: true })&lt;/code&gt;, enabling a center logo automatically locks Error Correction to &lt;strong&gt;Level H (30% codeword recovery)&lt;/strong&gt; and computes a conservative centered square window via &lt;code&gt;computeSafeCenterWindow(size)&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The cutout width is bounded so its area stays strictly $\le 20\%$ of the QR matrix (typically ~14–18% depending on QR version), centered on the matrix and clear of all three finder patterns and timing tracks.&lt;/li&gt;
&lt;li&gt;For Version 6 (41×41 modules, encoding a full HTTPS URL), the safe cutout is a 17×17 module window (&lt;code&gt;17.2%&lt;/code&gt; of matrix area), giving comfortable white margin around a centered mark while keeping Level H recovery headroom intact.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Eliminating Hairline Seams: Horizontal Run-Merged &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; SVG &amp;amp; CMYK EPS
&lt;/h2&gt;

&lt;p&gt;Naive QR SVG generators output one &lt;code&gt;&amp;lt;rect&amp;gt;&lt;/code&gt; per dark module. On non-integer DPR displays, PDF viewers, and vector cutters, adjacent rectangles create faint white sub-pixel lines between squares.&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;renderQrSvg()&lt;/code&gt; walks each row of the boolean matrix, merges contiguous dark modules into single horizontal runs, and emits one unified &lt;code&gt;&amp;lt;path d="..." fill="..." /&amp;gt;&lt;/code&gt; string:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fewer DOM/SVG nodes and smaller file sizes.&lt;/li&gt;
&lt;li&gt;Zero sub-pixel seams when zoomed to 1,000% or printed on signage.&lt;/li&gt;
&lt;li&gt;Feeds directly into our pure-TypeScript &lt;a href="https://www.logonib.com/tools/svg-to-eps" rel="noopener noreferrer"&gt;SVG to EPS converter&lt;/a&gt; (&lt;code&gt;convertSvgToEps&lt;/code&gt;), converting &lt;code&gt;#RRGGBB&lt;/code&gt; foreground and background ink into exact device CMYK (&lt;code&gt;setcmykcolor&lt;/code&gt;) PostScript vectors for print shops that still request &lt;code&gt;.eps&lt;/code&gt; artwork.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also run a live contrast audit (&lt;code&gt;auditQrContrast&lt;/code&gt;) checking WCAG relative luminance between foreground and background ink, flagging low-contrast palettes (&lt;code&gt;&amp;lt; 4.5:1&lt;/code&gt;) and inverted dark-background codes that trip up older phone camera scanners.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Safe Client-Side SVG Logo Uploads (Zero Same-Origin XSS)
&lt;/h2&gt;

&lt;p&gt;Allowing users to upload their own &lt;code&gt;.svg&lt;/code&gt; logo to overlay in the center of a QR code introduces a classic browser security risk: loading an untrusted &lt;code&gt;.svg&lt;/code&gt; file into a same-origin &lt;code&gt;image/svg+xml&lt;/code&gt; Blob URL or &lt;code&gt;{@html}&lt;/code&gt; can execute embedded scripts.&lt;/p&gt;

&lt;p&gt;To eliminate that class of vulnerability completely:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Any uploaded &lt;code&gt;.svg&lt;/code&gt; first passes through our preflight parser and strict sanitizer (&lt;code&gt;auditSvgPreflight&lt;/code&gt; + &lt;code&gt;optimizeSvg&lt;/code&gt;), stripping &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;, event handlers, foreign objects, and dangerous &lt;code&gt;href&lt;/code&gt;/&lt;code&gt;style&lt;/code&gt; payloads.&lt;/li&gt;
&lt;li&gt;We rasterize the sanitized SVG offscreen into a pure &lt;code&gt;image/png&lt;/code&gt; Blob before drawing it onto the QR preview canvas — never rendering uploaded SVG markup directly in the DOM.&lt;/li&gt;
&lt;li&gt;Downloadable &lt;code&gt;.svg&lt;/code&gt; files are constructed with MIME type &lt;code&gt;application/octet-stream&lt;/code&gt; so browsers always download the vector source cleanly rather than executing it in a tab.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Try It Free (Plus Companion Print Tools)
&lt;/h2&gt;

&lt;p&gt;Everything runs locally in your browser with zero login, zero watermark, and zero expiring redirect URLs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static Vector QR Code Generator (SVG, CMYK EPS, 4K PNG):&lt;/strong&gt; &lt;a href="https://www.logonib.com/tools/qr-code-logo-generator" rel="noopener noreferrer"&gt;https://www.logonib.com/tools/qr-code-logo-generator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Brand Color Palette, CMYK &amp;amp; WCAG 2.1 PDF Swatch Lab:&lt;/strong&gt; &lt;a href="https://www.logonib.com/tools/brand-color-palette-generator" rel="noopener noreferrer"&gt;https://www.logonib.com/tools/brand-color-palette-generator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free SVG to Print-Ready CMYK EPS Converter:&lt;/strong&gt; &lt;a href="https://www.logonib.com/tools/svg-to-eps" rel="noopener noreferrer"&gt;https://www.logonib.com/tools/svg-to-eps&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full 18-Tool Free Vector Suite:&lt;/strong&gt; &lt;a href="https://www.logonib.com/tools" rel="noopener noreferrer"&gt;https://www.logonib.com/tools&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you are launching a new business and need an original outlined vector logo (&lt;code&gt;SVG&lt;/code&gt;, &lt;code&gt;CMYK EPS&lt;/code&gt;, &lt;code&gt;300-DPI Print PDF&lt;/code&gt;, &lt;code&gt;4K PNG&lt;/code&gt;, &lt;code&gt;ICO&lt;/code&gt;) with full commercial ownership for a single one-time payment ($29, $49, or $89 — no recurring subscription), you can try six custom vector concepts for your brand free in &lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib Studio&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>svg</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Building a Pure-TypeScript SVG-to-EPS Vector PostScript Converter (CMYK, Elliptical Arcs, Zero Server Uploads)</title>
      <dc:creator>Hazel Fenwick</dc:creator>
      <pubDate>Wed, 02 Dec 2026 13:39:27 +0000</pubDate>
      <link>https://dev.to/hazelfenwick/building-a-pure-typescript-svg-to-eps-vector-postscript-converter-cmyk-elliptical-arcs-zero-2aam</link>
      <guid>https://dev.to/hazelfenwick/building-a-pure-typescript-svg-to-eps-vector-postscript-converter-cmyk-elliptical-arcs-zero-2aam</guid>
      <description>&lt;p&gt;Every time a small business sends a logo to a U.S. screen printer, embroidery shop, sign maker, or promotional merchandise vendor, the artwork spec sheet says the same thing:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Please upload your logo as a vector &lt;code&gt;.EPS&lt;/code&gt; or &lt;code&gt;.PDF&lt;/code&gt; file (fonts converted to outlines)."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you try to build a browser-native SVG-to-EPS converter without shipping a 40 MB Ghostscript or Inkscape WASM binary—and without uploading customer logos to a backend server—you quickly discover why most web converters are slow cloud queues behind paywalls.&lt;/p&gt;

&lt;p&gt;Here is how we built a pure-TypeScript &lt;strong&gt;EPSF-3.0 (&lt;code&gt;%!PS-Adobe-3.0 EPSF-3.0&lt;/code&gt;)&lt;/strong&gt; vector PostScript compiler in ~1,100 lines of zero-dependency code for LogoNib's free browser tool (&lt;a href="https://www.logonib.com/tools/svg-to-eps" rel="noopener noreferrer"&gt;logonib.com/tools/svg-to-eps&lt;/a&gt;) and our one-time vector brand packs.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Coordinate Flip: SVG Top-Down vs. PostScript Bottom-Up
&lt;/h2&gt;

&lt;p&gt;SVG places &lt;code&gt;(0, 0)&lt;/code&gt; at the &lt;strong&gt;top-left&lt;/strong&gt; corner with &lt;code&gt;+Y&lt;/code&gt; pointing downward. Encapsulated PostScript (EPS) places &lt;code&gt;(0, 0)&lt;/code&gt; at the &lt;strong&gt;bottom-left&lt;/strong&gt; corner with &lt;code&gt;+Y&lt;/code&gt; pointing upward.&lt;/p&gt;

&lt;p&gt;Instead of manually flipping every &lt;code&gt;y&lt;/code&gt; coordinate and negating every arc sweep or rotation angle inside each shape converter, you can apply a single global affine transform right after &lt;code&gt;%%EndSetup&lt;/code&gt; inside balanced &lt;code&gt;gsave&lt;/code&gt; / &lt;code&gt;grestore&lt;/code&gt; blocks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight postscript"&gt;&lt;code&gt;&lt;span class="n"&gt;gsave&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;concat&lt;/span&gt;
&lt;span class="c1"&gt;% All subsequent SVG coordinates map 1:1 into PostScript space&lt;/span&gt;
&lt;span class="n"&gt;grestore&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the SVG has a non-zero &lt;code&gt;viewBox="minX minY width height"&lt;/code&gt;, you compose the scale and translation into that root matrix so every shape lands cleanly inside &lt;code&gt;%%BoundingBox: 0 0 &amp;lt;widthPt&amp;gt; &amp;lt;heightPt&amp;gt;&lt;/code&gt; and &lt;code&gt;%%HiResBoundingBox&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Converting SVG Path Commands (Especially Quadratic Curves and Elliptical Arcs)
&lt;/h2&gt;

&lt;p&gt;PostScript natively speaks &lt;code&gt;moveto&lt;/code&gt;, &lt;code&gt;lineto&lt;/code&gt;, &lt;code&gt;curveto&lt;/code&gt; (cubic Bézier), and &lt;code&gt;closepath&lt;/code&gt;. It does &lt;strong&gt;not&lt;/strong&gt; have SVG's quadratic Bézier (&lt;code&gt;Q&lt;/code&gt;/&lt;code&gt;T&lt;/code&gt;) or elliptical arc (&lt;code&gt;A&lt;/code&gt;/&lt;code&gt;a&lt;/code&gt;) path commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Degree-Elevating Quadratic Béziers (&lt;code&gt;Q&lt;/code&gt;/&lt;code&gt;T&lt;/code&gt;) to Cubic (&lt;code&gt;curveto&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Every quadratic Bézier from &lt;code&gt;P0&lt;/code&gt; through control point &lt;code&gt;P1&lt;/code&gt; to &lt;code&gt;P2&lt;/code&gt; converts &lt;strong&gt;exactly&lt;/strong&gt; to a cubic Bézier &lt;code&gt;(C1, C2, P2)&lt;/code&gt; with zero approximation loss:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c1x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;x0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c1y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;y0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qy&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;y0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c2x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;x2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c2y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;y2&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qy&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;y2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;ops&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${fmt(c1x)} ${fmt(c1y)} ${fmt(c2x)} ${fmt(c2y)} ${fmt(x2)} ${fmt(y2)} curveto`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Converting Elliptical Arcs (&lt;code&gt;A&lt;/code&gt;/&lt;code&gt;a&lt;/code&gt;) to Cubic Segments
&lt;/h3&gt;

&lt;p&gt;For &lt;code&gt;A rx ry xAxisRotation largeArcFlag sweepFlag x y&lt;/code&gt;, we implement the W3C SVG F.6.5/F.6.6 endpoint-to-center parameterization:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Transform the midpoint into rotated ellipse space and scale up &lt;code&gt;rx, ry&lt;/code&gt; if the radii are too small to reach the endpoint.&lt;/li&gt;
&lt;li&gt;Compute the ellipse center &lt;code&gt;(cx, cy)&lt;/code&gt;, start angle &lt;code&gt;θ1&lt;/code&gt;, and sweep &lt;code&gt;Δθ&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Subdivide &lt;code&gt;|Δθ|&lt;/code&gt; into segments of at most &lt;code&gt;π/2&lt;/code&gt; radians (&lt;code&gt;90°&lt;/code&gt;) and emit one cubic Bézier per segment using &lt;code&gt;α = (4/3) · tan(Δθ_seg / 4)&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For &lt;code&gt;&amp;lt;circle&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;ellipse&amp;gt;&lt;/code&gt;, four &lt;code&gt;90°&lt;/code&gt; cubic segments using &lt;code&gt;κ ≈ 0.5522847498&lt;/code&gt; give sub-pixel accuracy cleanly across Illustrator, CorelDRAW, Inkscape, and RIP software.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Print CMYK (&lt;code&gt;setcmykcolor&lt;/code&gt;) &amp;amp; Alpha Compositing
&lt;/h2&gt;

&lt;p&gt;PostScript Level 2/3 EPS does &lt;strong&gt;not&lt;/strong&gt; support native alpha transparency (&lt;code&gt;fill-opacity&lt;/code&gt; or &lt;code&gt;rgba()&lt;/code&gt;). If you silently ignore opacity, a &lt;code&gt;20%&lt;/code&gt; gray accent turns solid black in print.&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;emitColorOp()&lt;/code&gt; helper composites any semi-transparent color over white (&lt;code&gt;blendWithWhite&lt;/code&gt;) before emitting either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Print CMYK mode:&lt;/strong&gt; &lt;code&gt;c m y k setcmykcolor&lt;/code&gt; (using deterministic RGB-to-CMYK conversion)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Screen RGB mode:&lt;/strong&gt; &lt;code&gt;r g b setrgbcolor&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And for &lt;code&gt;fill-rule="evenodd"&lt;/code&gt;, we switch PostScript's paint operator from &lt;code&gt;fill&lt;/code&gt; to &lt;code&gt;eofill&lt;/code&gt;—preserving hollow ring cutouts and compound emblem geometry accurately.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Security Hardening: Treating Untrusted SVGs Safely
&lt;/h2&gt;

&lt;p&gt;SVG is XML that can carry &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;, inline &lt;code&gt;on*&lt;/code&gt; handlers, &lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt;, SMIL animation payloads, or maliciously nested transforms—and EPS headers themselves can be broken by newline injection inside &lt;code&gt;%%Title:&lt;/code&gt; comments.&lt;/p&gt;

&lt;p&gt;Before a single PostScript line is emitted:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We pre-sanitize the SVG through our sanitizer and pre-flight auditor (&lt;code&gt;optimizeSvg&lt;/code&gt; + &lt;code&gt;auditSvgPreflight&lt;/code&gt;), stripping dangerous tags/attributes and surfacing warnings if live &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; nodes aren't converted to outlines.&lt;/li&gt;
&lt;li&gt;We cap nesting depth (&lt;code&gt;64&lt;/code&gt;), shape count (&lt;code&gt;10,000&lt;/code&gt;), and commands per path (&lt;code&gt;25,000&lt;/code&gt;) to prevent browser freezes on pathological files.&lt;/li&gt;
&lt;li&gt;We strip control characters and non-ASCII bytes from &lt;code&gt;%%Title&lt;/code&gt; comments (&lt;code&gt;sanitizePsComment&lt;/code&gt;) so header lines cannot inject arbitrary PostScript operators.&lt;/li&gt;
&lt;li&gt;On the web UI, we &lt;strong&gt;never&lt;/strong&gt; render user-uploaded SVGs with &lt;code&gt;{@html}&lt;/code&gt; or same-origin &lt;code&gt;image/svg+xml&lt;/code&gt; Blob URLs—previews are rasterized safely to PNG bytes first.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Try It Free (Zero Uploads, Zero Sign-Up)
&lt;/h2&gt;

&lt;p&gt;You can test the converter on any SVG logo right in your browser (with both &lt;strong&gt;Print CMYK&lt;/strong&gt; and &lt;strong&gt;Screen RGB&lt;/strong&gt; modes plus a raw PostScript source inspector):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Free Browser SVG-to-EPS Converter:&lt;/strong&gt; &lt;a href="https://www.logonib.com/tools/svg-to-eps" rel="noopener noreferrer"&gt;https://www.logonib.com/tools/svg-to-eps&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free Browser JPG-to-SVG Vector Tracer:&lt;/strong&gt; &lt;a href="https://www.logonib.com/tools/jpg-to-svg" rel="noopener noreferrer"&gt;https://www.logonib.com/tools/jpg-to-svg&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All 16 Free Browser Logo &amp;amp; Print Utilities:&lt;/strong&gt; &lt;a href="https://www.logonib.com/tools" rel="noopener noreferrer"&gt;https://www.logonib.com/tools&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And if you are creating a new brand logo from scratch without recurring subscriptions, &lt;strong&gt;LogoNib&lt;/strong&gt; (&lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;https://www.logonib.com&lt;/a&gt;) lets you generate and edit custom vector concepts free in your browser—then download your full print-ready package (&lt;strong&gt;outlined SVGs, CMYK &amp;amp; mono EPS files, 300-DPI Print Vector PDF, 4K PNGs, and commercial copyright certificate&lt;/strong&gt;) for a single one-time payment starting at &lt;strong&gt;$29&lt;/strong&gt; ($49 for the Complete Brand Kit, $89 for Studio Multi-Concept), backed by a 30-day refund guarantee.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>graphics</category>
      <category>svg</category>
    </item>
    <item>
      <title>Why Illustrator SVG Exports Are 3 Larger (and Sometimes Unsafe) — Engineering a Zero-Dependency Browser SVG Optimizer &amp; 300-DPI Pre-Press Checker</title>
      <dc:creator>Hazel Fenwick</dc:creator>
      <pubDate>Wed, 02 Dec 2026 12:29:47 +0000</pubDate>
      <link>https://dev.to/hazelfenwick/why-illustrator-svg-exports-are-3x-larger-and-sometimes-unsafe-engineering-a-zero-dependency-4coi</link>
      <guid>https://dev.to/hazelfenwick/why-illustrator-svg-exports-are-3x-larger-and-sometimes-unsafe-engineering-a-zero-dependency-4coi</guid>
      <description>&lt;p&gt;Every print shop and frontend engineer eventually hits the same two logo files from a client or founder:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;strong&gt;"vector logo"&lt;/strong&gt; exported from Illustrator, Inkscape, or Sketch that weighs 18 KB for four simple shapes — stuffed with &lt;code&gt;xmlns:inkscape&lt;/code&gt;, &lt;code&gt;sodipodi:namedview&lt;/code&gt;, &lt;code&gt;data-name&lt;/code&gt;, &lt;code&gt;&amp;lt;metadata&amp;gt;&lt;/code&gt;, empty nested &lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt; wrappers, 7-decimal coordinates (&lt;code&gt;142.8571429&lt;/code&gt;), and occasionally even an inline &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; or &lt;code&gt;onload&lt;/code&gt; attribute from a third-party template.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;500 × 500 px PNG&lt;/strong&gt; that looks razor-sharp inside a Slack avatar — right up until a commercial printer rejects it because at 300 DPI it can only print &lt;strong&gt;1.67 × 1.67 inches&lt;/strong&gt; before visibly pixelating on a 3.5 × 2 inch business card or 11-inch T-shirt chest print.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Neither problem should require uploading proprietary brand files to a third-party server or installing desktop CAD tooling. We built two zero-upload, pure-TypeScript browser tools at &lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib&lt;/a&gt; — a &lt;a href="https://www.logonib.com/tools/svg-optimizer" rel="noopener noreferrer"&gt;Client-Side SVG Optimizer &amp;amp; Cleaner&lt;/a&gt; and a &lt;a href="https://www.logonib.com/tools/print-dpi-calculator" rel="noopener noreferrer"&gt;Print Logo DPI &amp;amp; Physical Size Checker&lt;/a&gt; — that run 100% locally in the browser with zero account gates and zero server uploads.&lt;/p&gt;

&lt;p&gt;Here is how both engines work under the hood, and the subtle edge cases that break naive regex minifiers.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Security First: Sanitizing Untrusted SVGs Before Rendering
&lt;/h2&gt;

&lt;p&gt;Unlike PNG or JPEG, an SVG file is an executable XML document. If you accept a user-uploaded &lt;code&gt;.svg&lt;/code&gt; and render it via &lt;code&gt;innerHTML&lt;/code&gt; or an &lt;code&gt;image/svg+xml&lt;/code&gt; Blob URL on your own origin, an attacker can execute arbitrary JavaScript inside your origin via:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;script&amp;gt;...&amp;lt;/script&amp;gt;&lt;/code&gt; elements&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt; HTML injection&lt;/li&gt;
&lt;li&gt;Inline event handlers (&lt;code&gt;onload=&lt;/code&gt;, &lt;code&gt;onclick=&lt;/code&gt;, &lt;code&gt;onerror=&lt;/code&gt;, &lt;code&gt;onbegin=&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Dangerous &lt;code&gt;href&lt;/code&gt; / &lt;code&gt;xlink:href&lt;/code&gt; schemes (&lt;code&gt;javascript:&lt;/code&gt;, &lt;code&gt;data:text/html&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Our &lt;a href="https://www.logonib.com/tools/svg-optimizer" rel="noopener noreferrer"&gt;Client-Side SVG Optimizer &amp;amp; Cleaner&lt;/a&gt; enforces two invariants simultaneously:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Always-on active content stripping:&lt;/strong&gt; Regardless of which visual cleanup toggles a user turns on or off, the sanitizer strips &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt;, all &lt;code&gt;on*&lt;/code&gt; event attributes, and &lt;code&gt;javascript:&lt;/code&gt; / &lt;code&gt;data:text/html&lt;/code&gt; links — and counts every stripped vector element explicitly in the report.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never render user SVG in the live DOM:&lt;/strong&gt; Instead of injecting raw markup into the page, the browser rasterizes the sanitized SVG into a static PNG via an off-screen canvas (&lt;code&gt;renderSvgToPngBytes&lt;/code&gt;) so the live Light / Dark / Checkerboard preview can never execute markup.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  2. Why Naive Number Rounding Corrupts SVGs
&lt;/h2&gt;

&lt;p&gt;Once active content, XML comments (&lt;code&gt;&amp;lt;!-- ... --&amp;gt;&lt;/code&gt;), &lt;code&gt;&amp;lt;?xml?&amp;gt;&lt;/code&gt; prologs, &lt;code&gt;&amp;lt;!DOCTYPE&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;metadata&amp;gt;&lt;/code&gt;, and editor namespaces (&lt;code&gt;xmlns:inkscape&lt;/code&gt;, &lt;code&gt;xmlns:sodipodi&lt;/code&gt;, &lt;code&gt;xmlns:sketch&lt;/code&gt;, &lt;code&gt;inkscape:*&lt;/code&gt;, &lt;code&gt;sodipodi:*&lt;/code&gt;, &lt;code&gt;data-name&lt;/code&gt;) are removed, the single largest remaining byte savings comes from &lt;strong&gt;coordinate precision rounding&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Desktop vector tools routinely write floating-point paths like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;path&lt;/span&gt; &lt;span class="na"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"M 12.000001 48.3333333 L 96.4999999 48.3333333 C 110.123456 48.3333333 120.987654 58.123456 120.987654 72.000000 Z"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rounding coordinates to &lt;code&gt;2&lt;/code&gt; decimal places (&lt;code&gt;12 48.33 L 96.5 48.33 ...&lt;/code&gt;) typically cuts path string size by &lt;strong&gt;40% to 70%&lt;/strong&gt; with zero human-visible geometry drift at any print or screen scale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The trap:&lt;/strong&gt; If you blindly run a global float-rounding regex across the entire SVG string, you will corrupt:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;viewBox="0 0 100.5 100.5"&lt;/code&gt; (rounding a tight integer or fractional viewBox shifts clipping boundaries)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;version="1.1"&lt;/code&gt; (turning &lt;code&gt;1.1&lt;/code&gt; into &lt;code&gt;1&lt;/code&gt; if precision is &lt;code&gt;0&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Text content or &lt;code&gt;opacity="0.125"&lt;/code&gt; values&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead, our optimizer targets &lt;strong&gt;geometry attributes specifically&lt;/strong&gt; — &lt;code&gt;d&lt;/code&gt;, &lt;code&gt;points&lt;/code&gt;, &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;x1&lt;/code&gt;, &lt;code&gt;y1&lt;/code&gt;, &lt;code&gt;x2&lt;/code&gt;, &lt;code&gt;y2&lt;/code&gt;, &lt;code&gt;cx&lt;/code&gt;, &lt;code&gt;cy&lt;/code&gt;, &lt;code&gt;r&lt;/code&gt;, &lt;code&gt;rx&lt;/code&gt;, &lt;code&gt;ry&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, &lt;code&gt;height&lt;/code&gt;, &lt;code&gt;stroke-width&lt;/code&gt; — while leaving &lt;code&gt;viewBox&lt;/code&gt;, &lt;code&gt;version&lt;/code&gt;, and non-geometric attributes untouched, and iteratively collapsing empty &lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt; groups bottom-up (&lt;code&gt;&amp;lt;g&amp;gt;&amp;lt;g&amp;gt;&amp;lt;/g&amp;gt;&amp;lt;/g&amp;gt;&lt;/code&gt; -&amp;gt; removed in two passes).&lt;/p&gt;

&lt;p&gt;On a realistic Illustrator logo export (&lt;code&gt;~1.96 KB&lt;/code&gt;), enabling precision &lt;code&gt;2&lt;/code&gt; + metadata/editor stripping cuts the file to &lt;strong&gt;&lt;code&gt;483–609 bytes&lt;/code&gt; (&lt;code&gt;69%–76%&lt;/code&gt; smaller)&lt;/strong&gt; in under 2 milliseconds — and runs our &lt;a href="https://www.logonib.com/tools/svg-font-outline-checker" rel="noopener noreferrer"&gt;SVG Font Outline Pre-Flight Checker&lt;/a&gt; simultaneously to warn if any live &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; tags are still waiting to break at the print shop.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Exact 300-DPI Pre-Press Math for US Commercial Print Specs
&lt;/h2&gt;

&lt;p&gt;The other half of print rejections is simpler mathematically, yet catches thousands of small businesses ordering signage, packaging, and apparel: &lt;strong&gt;effective print DPI&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Effective DPI = min(pixelWidth / printWidthInches, pixelHeight / printHeightInches)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the maximum safe physical print width at a target DPI is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Max Safe Inches = pixelDimension / targetDPI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Different physical substrates require very different effective DPI thresholds because viewing distance varies:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Print Deliverable&lt;/th&gt;
&lt;th&gt;Typical Logo Area&lt;/th&gt;
&lt;th&gt;Target DPI&lt;/th&gt;
&lt;th&gt;Min Pixels Needed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Business Card (&lt;code&gt;3.5" × 2"&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.5" × 0.75"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;300 DPI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;450 × 225 px&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Letterhead / Invoice Header&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2.0" × 0.75"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;300 DPI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;600 × 225 px&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Product Packaging / Sticker&lt;/td&gt;
&lt;td&gt;&lt;code&gt;3.0" × 3.0"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;300 DPI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;900 × 900 px&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Left-Chest Embroidery / Screen Print&lt;/td&gt;
&lt;td&gt;&lt;code&gt;4.0" × 4.0"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;300 DPI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1200 × 1200 px&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Full-Front T-Shirt Print&lt;/td&gt;
&lt;td&gt;&lt;code&gt;11.0" × 11.0"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;300 DPI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;3300 × 3300 px&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trade-Show Retractable Banner&lt;/td&gt;
&lt;td&gt;&lt;code&gt;30.0" × 12.0"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;150 DPI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;4500 × 1800 px&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6-Foot Vinyl Backdrop / Signage&lt;/td&gt;
&lt;td&gt;&lt;code&gt;48.0" × 18.0"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;100 DPI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;4800 × 1800 px&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;In the &lt;a href="https://www.logonib.com/tools/print-dpi-calculator" rel="noopener noreferrer"&gt;Print Logo DPI &amp;amp; Physical Size Checker&lt;/a&gt;, dropping any PNG, JPG, WebP, or SVG immediately inspects native dimensions in-browser, computes effective DPI across all 10 US commercial print presets (plus custom dimensions in inches or mm), and classifies every deliverable as &lt;strong&gt;PASS&lt;/strong&gt; (&lt;code&gt;&amp;gt;= target&lt;/code&gt;), &lt;strong&gt;WARN&lt;/strong&gt; (&lt;code&gt;75%–99%&lt;/code&gt; of target), or &lt;strong&gt;FAIL&lt;/strong&gt; (&lt;code&gt;&amp;lt; 75%&lt;/code&gt;).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you drop an &lt;strong&gt;SVG&lt;/strong&gt;, every single preset evaluates to &lt;strong&gt;Infinite Vector Resolution (PASS)&lt;/strong&gt; — because mathematical Bézier paths rasterize cleanly at 300 DPI whether on a 1-inch stamp or a 6-foot trade-show banner.&lt;/li&gt;
&lt;li&gt;If a raster PNG &lt;strong&gt;fails 300 DPI&lt;/strong&gt;, the tool surfaces an instant bridge to our free client-side &lt;a href="https://www.logonib.com/tools/png-to-svg" rel="noopener noreferrer"&gt;PNG to SVG Vector Tracer&lt;/a&gt; (or our &lt;a href="https://www.logonib.com/tools/svg-to-pdf-print" rel="noopener noreferrer"&gt;SVG to Print-Ready PDF Converter&lt;/a&gt; with &lt;code&gt;0.125"&lt;/code&gt; bleed and crop marks) so you can fix the file immediately without leaving the browser.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Try Both Tools Free (No Signup, Zero Upload)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/svg-optimizer" rel="noopener noreferrer"&gt;Client-Side SVG Optimizer &amp;amp; Cleaner&lt;/a&gt;&lt;/strong&gt; — sanitize active SVG markup, strip Illustrator/Inkscape/Sketch bloat, round path precision, verify pre-press outlined &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; compliance, and download &lt;code&gt;.min.svg&lt;/code&gt; locally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/print-dpi-calculator" rel="noopener noreferrer"&gt;Print Logo DPI &amp;amp; Physical Size Checker&lt;/a&gt;&lt;/strong&gt; — check any PNG, JPG, WebP, or SVG against 10 US commercial print standards (business cards, stickers, apparel, banners) and get exact max safe inches/mm at 300, 150, and 100 DPI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools" rel="noopener noreferrer"&gt;All 14 Free Browser Brand Engineering Tools&lt;/a&gt;&lt;/strong&gt; — including PNG-to-SVG tracing, background removal, CMYK/WCAG conversion, favicon packing, and business card PDF generation.&lt;/li&gt;
&lt;li&gt;Need a brand-new logo built from scratch as mathematically outlined vector geometry (&lt;code&gt;.svg&lt;/code&gt;, 300-DPI vector &lt;code&gt;.pdf&lt;/code&gt;, CMYK brand guide, favicons, and social pack, &lt;code&gt;$29–$89&lt;/code&gt; one-time with zero subscriptions)? Try the free interactive studio at &lt;strong&gt;&lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib&lt;/a&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>design</category>
      <category>svg</category>
    </item>
    <item>
      <title>Writing a 14ms Pure-TypeScript PNG-to-SVG Vector Tracer (No Server Uploads, No WASM, Zero XSS)</title>
      <dc:creator>Hazel Fenwick</dc:creator>
      <pubDate>Tue, 01 Dec 2026 16:59:51 +0000</pubDate>
      <link>https://dev.to/hazelfenwick/writing-a-14ms-pure-typescript-png-to-svg-vector-tracer-no-server-uploads-no-wasm-zero-xss-1nld</link>
      <guid>https://dev.to/hazelfenwick/writing-a-14ms-pure-typescript-png-to-svg-vector-tracer-no-server-uploads-no-wasm-zero-xss-1nld</guid>
      <description>&lt;p&gt;Most "free PNG to SVG" and "remove logo background" websites do the same thing: upload your brand files to a remote server, run a heavy ImageMagick or Potrace container, watermark the download, or throw a paywall right before export.&lt;/p&gt;

&lt;p&gt;While building the free browser production toolkit for &lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib&lt;/a&gt;, we wanted four utilities that founders and print shops actually need every day to run &lt;strong&gt;100% client-side in plain TypeScript&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/png-to-svg" rel="noopener noreferrer"&gt;PNG to SVG Vector Tracer&lt;/a&gt;&lt;/strong&gt; — multi-color flat logo tracing with 4x pixel-vs-vector edge zoom.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/make-logo-transparent" rel="noopener noreferrer"&gt;Transparent Logo Background Remover&lt;/a&gt;&lt;/strong&gt; — 4-neighbor edge flood-fill + linear alpha feathering + auto-trim.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/svg-to-pdf-print" rel="noopener noreferrer"&gt;SVG / PNG to 300-DPI Print PDF Converter&lt;/a&gt;&lt;/strong&gt; — exact &lt;code&gt;0.125"&lt;/code&gt; bleed + &lt;code&gt;0.5pt&lt;/code&gt; vector registration crop marks in &lt;code&gt;pdf-lib&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/logo-mockup-preview" rel="noopener noreferrer"&gt;Logo Mockup &amp;amp; Legibility Stress Test&lt;/a&gt;&lt;/strong&gt; — 5 real-world surfaces (24px favicon, dark app icon, print card, 1-color stamp, invoice letterhead) + 1600x1000 proof sheet PNG export.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here are the four engineering details that made the pure-TypeScript tracer fast (~14ms on a 512px mark), deterministic across unit tests, and safe against untrusted SVG uploads.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Strip the Solid Background Before Quantizing Colors
&lt;/h2&gt;

&lt;p&gt;If you quantize a 3-color logo sitting on a white JPG background without stripping the background first, white eats one of your palette slots and emits a giant full-canvas rectangle path behind the mark.&lt;/p&gt;

&lt;p&gt;We first sample the four corner pixels (&lt;code&gt;sampleCornerBackground&lt;/code&gt;) and run an iterative 4-neighbor BFS flood-fill from the image border (&lt;code&gt;removeLogoBackground&lt;/code&gt; in &lt;code&gt;transparent-bg.ts&lt;/code&gt;). Using an explicit typed queue (&lt;code&gt;Int32Array&lt;/code&gt;) instead of recursion avoids call-stack overflows on 4096x4096 uploads, and separating &lt;strong&gt;edge flood-fill&lt;/strong&gt; from &lt;strong&gt;global match&lt;/strong&gt; preserves white interior highlights (like the white center of a badge) while clearing the exterior background.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;TraceOptions&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'mono'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'color'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;colorCount&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;threshold&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;monoColor&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;removeBackground&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;bgTolerance&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;simplifyEpsilon&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;smoothCurves&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;minPathArea&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. Deterministic Quantization (Zero &lt;code&gt;Math.random()&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;A classic mistake in browser k-means quantization is random centroid initialization: the same logo traces into slightly different palettes every time a user drags a slider, and unit tests become flaky.&lt;/p&gt;

&lt;p&gt;Instead, we bin foreground RGB values into a coarse histogram, sort buckets deterministically by frequency + luminance tie-breaker, pick initial centroids by maximum squared RGB distance (deterministic farthest-point seeding), and iterate weighted Lloyd refinement for a fixed number of passes. Layers are emitted largest-area first so flat colors stack cleanly.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Exact &lt;code&gt;(w + 1) × (h + 1)&lt;/code&gt; Lattice Contour Tracing for Clean Holes
&lt;/h2&gt;

&lt;p&gt;Tracing pixels directly causes off-by-half-pixel shifts and loses interior holes (the counter inside an &lt;code&gt;"O"&lt;/code&gt;, &lt;code&gt;"A"&lt;/code&gt;, or ring icon).&lt;/p&gt;

&lt;p&gt;Instead, treat every foreground pixel &lt;code&gt;(x, y)&lt;/code&gt; as a unit square on the &lt;code&gt;(width + 1) × (height + 1)&lt;/code&gt; vertex lattice and emit directed boundary edges whenever a foreground pixel borders a background pixel:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Top edge &lt;code&gt;(x, y) -&amp;gt; (x + 1, y)&lt;/code&gt; if &lt;code&gt;(x, y - 1)&lt;/code&gt; is outside&lt;/li&gt;
&lt;li&gt;Right edge &lt;code&gt;(x + 1, y) -&amp;gt; (x + 1, y + 1)&lt;/code&gt; if &lt;code&gt;(x + 1, y)&lt;/code&gt; is outside&lt;/li&gt;
&lt;li&gt;Bottom edge &lt;code&gt;(x + 1, y + 1) -&amp;gt; (x, y + 1)&lt;/code&gt; if &lt;code&gt;(x, y + 1)&lt;/code&gt; is outside&lt;/li&gt;
&lt;li&gt;Left edge &lt;code&gt;(x, y + 1) -&amp;gt; (x, y)&lt;/code&gt; if &lt;code&gt;(x - 1, y)&lt;/code&gt; is outside&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Chaining those directed segments automatically yields closed outer contours and opposite-winding interior hole loops in linear time. Emitting all loops for a color layer into one &lt;code&gt;&amp;lt;path d="..." fill="#RRGGBB" fill-rule="evenodd" /&amp;gt;&lt;/code&gt; cuts clean interior holes with zero boolean geometry library required.&lt;/p&gt;

&lt;p&gt;From there:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Drop speckle noise where &lt;code&gt;|signedArea| &amp;lt; minPathArea&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run closed-loop &lt;strong&gt;Douglas-Peucker&lt;/strong&gt; polygon simplification (&lt;code&gt;simplifyEpsilon&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Fit corner-preserving quadratic Bezier midpoint curves (&lt;code&gt;M ... Q ... Z&lt;/code&gt;), keeping sharp corners intact whenever the turning angle exceeds the corner threshold.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On our built-in geometric sample, the full pipeline (background strip -&amp;gt; quantization -&amp;gt; contour loops -&amp;gt; Douglas-Peucker -&amp;gt; Bezier fit) runs in &lt;strong&gt;~14ms&lt;/strong&gt; on the main thread, producing a 1.2 KB clean SVG.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Previewing User SVGs Without Same-Origin XSS
&lt;/h2&gt;

&lt;p&gt;If you build any client-side tool that accepts user-uploaded &lt;code&gt;.svg&lt;/code&gt; files (like our &lt;a href="https://www.logonib.com/tools/svg-to-pdf-print" rel="noopener noreferrer"&gt;SVG-to-Print-PDF Converter&lt;/a&gt; or &lt;a href="https://www.logonib.com/tools/logo-mockup-preview" rel="noopener noreferrer"&gt;Logo Mockup Stress Test&lt;/a&gt;), never inject the uploaded markup into the DOM with &lt;code&gt;innerHTML&lt;/code&gt; / &lt;code&gt;{@html}&lt;/code&gt;, and never serve untrusted SVG through a same-origin &lt;code&gt;image/svg+xml&lt;/code&gt; Blob URL that could be navigated directly.&lt;/p&gt;

&lt;p&gt;Instead:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Parse and inspect the XML tree first (&lt;code&gt;auditSvgPreflight&lt;/code&gt;), blocking &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;foreignObject&amp;gt;&lt;/code&gt;, &lt;code&gt;on*&lt;/code&gt; event attributes, and &lt;code&gt;javascript:&lt;/code&gt;/&lt;code&gt;data:&lt;/code&gt; URIs — while also catching un-outlined &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; tags that fail at commercial print shops.&lt;/li&gt;
&lt;li&gt;Rasterize the sanitized SVG to an offscreen &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; and export a safe &lt;code&gt;image/png&lt;/code&gt; Blob URL (&lt;code&gt;renderSvgToPngBytes&lt;/code&gt;) for every on-page preview and &lt;code&gt;pdf-lib&lt;/code&gt; embed, revoking object URLs on cleanup.&lt;/li&gt;
&lt;li&gt;For traced SVG output in &lt;code&gt;/tools/png-to-svg&lt;/code&gt;, construct the XML strictly from formatted numeric coordinates and regex-validated &lt;code&gt;#RRGGBB&lt;/code&gt; hex fills — zero raw user strings ever enter the SVG string.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  When Auto-Tracing Is Enough (And When It Isn't)
&lt;/h2&gt;

&lt;p&gt;Auto-tracing works great on clean flat icons, monochrome stamps, and sharp high-resolution emblems. It struggles on compressed low-res JPGs or AI-generated raster logos with baked-in text and gradients — no tracer can invent clean font curves from blurred pixels.&lt;/p&gt;

&lt;p&gt;When a logo needs crisp typography and mathematically pure Bezier paths for signage, embroidery, or print packaging, building from native vector geometry and &lt;code&gt;opentype.js&lt;/code&gt; font-to-path outlining is still the right foundation.&lt;/p&gt;

&lt;p&gt;You can try all four browser tools completely free with zero signup or uploads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.logonib.com/tools/png-to-svg" rel="noopener noreferrer"&gt;Free PNG to SVG Vector Tracer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.logonib.com/tools/make-logo-transparent" rel="noopener noreferrer"&gt;Free Transparent Logo Background Remover&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.logonib.com/tools/svg-to-pdf-print" rel="noopener noreferrer"&gt;Free SVG to 300-DPI Print PDF Converter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.logonib.com/tools/logo-mockup-preview" rel="noopener noreferrer"&gt;Free Logo Mockup &amp;amp; Legibility Stress Test&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Or design an outlined vector logo from scratch at &lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>typescript</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Why Converting a PNG or AI Logo to SVG Usually Fails at Print Shops (And a 6-Point SVG Pre-Flight Check)</title>
      <dc:creator>Hazel Fenwick</dc:creator>
      <pubDate>Mon, 30 Nov 2026 16:41:12 +0000</pubDate>
      <link>https://dev.to/hazelfenwick/why-converting-a-png-or-ai-logo-to-svg-usually-fails-at-print-shops-and-a-6-point-svg-pre-flight-5b0n</link>
      <guid>https://dev.to/hazelfenwick/why-converting-a-png-or-ai-logo-to-svg-usually-fails-at-print-shops-and-a-6-point-svg-pre-flight-5b0n</guid>
      <description>&lt;p&gt;Every week, founders generate a logo as a &lt;code&gt;1024×1024&lt;/code&gt; PNG—from an AI image generator, a slide deck, or a quick web mockup—run it through the first "PNG to SVG converter" they find on Google, and upload the result to a print shop for business cards, signage, or merch.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/o1Vg5zk63RQ" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;A day later, pre-press rejects the file.&lt;/p&gt;

&lt;p&gt;Almost every rejection comes down to one of three hidden defects inside the &lt;code&gt;.svg&lt;/code&gt; file. None of them are obvious when you preview the logo in Chrome on a laptop.&lt;/p&gt;




&lt;h2&gt;
  
  
  Defect 1: The "Fake SVG" (Base64 PNG Wrapped Inside &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;A surprising number of free "PNG to SVG" tools do not trace vectors at all. They base64-encode your raster PNG and wrap it inside a 4-line SVG container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;xmlns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"http://www.w3.org/2000/svg"&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"512"&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"512"&lt;/span&gt; &lt;span class="na"&gt;viewBox&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"0 0 512 512"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;image&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"512"&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"512"&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"data:image/png;base64,iVBORw0KGgoAAAANSUhEUg..."&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the filename ends in &lt;code&gt;.svg&lt;/code&gt;, it looks right on a screen. At 300 DPI print resolution, however, a &lt;code&gt;512px&lt;/code&gt; embedded bitmap can only print &lt;code&gt;1.71 inches&lt;/code&gt; wide (&lt;code&gt;512 ÷ 300 = 1.71"&lt;/code&gt;). Stretch it across a &lt;code&gt;12"&lt;/code&gt; tote bag or a &lt;code&gt;36"&lt;/code&gt; trade-show banner and every edge turns blurry. Vinyl cutters and embroidery digitizers reject &lt;code&gt;&amp;lt;image&amp;gt;&lt;/code&gt; tags outright because there are no vector cut paths to follow.&lt;/p&gt;




&lt;h2&gt;
  
  
  Defect 2: Live &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; Tags That Silently Swap Fonts
&lt;/h2&gt;

&lt;p&gt;When a browser tool or design app exports a logo with live &lt;code&gt;&amp;lt;text font-family="Fraunces"&amp;gt;&lt;/code&gt; elements, the SVG does not carry the font file inside it. It relies on the recipient's computer having that exact font installed.&lt;/p&gt;

&lt;p&gt;When a print shop opens the file in Illustrator or CorelDRAW without your font installed, the software silently substitutes Arial or Helvetica—wrecking letter spacing, line width, and emblem alignment.&lt;/p&gt;

&lt;p&gt;Production vector logos convert every character into closed &lt;code&gt;&amp;lt;path d="..."&amp;gt;&lt;/code&gt; outlines using font glyph geometry (for example via &lt;code&gt;opentype.js&lt;/code&gt;) before export. Once outlined, &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; count is &lt;code&gt;0&lt;/code&gt;, and the logo renders identically on every RIP, plotter, and browser forever.&lt;/p&gt;




&lt;h2&gt;
  
  
  Defect 3: Bitmap Auto-Tracing Destroys Thin Typography
&lt;/h2&gt;

&lt;p&gt;Even real bitmap tracers (Potrace, Image Trace, and ML vectorizers) struggle with small wordmarks and AI-generated logos:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anti-aliased gray pixels around small letters turn into wobbly multi-node curves instead of straight stems.&lt;/li&gt;
&lt;li&gt;Counters inside &lt;code&gt;e&lt;/code&gt;, &lt;code&gt;a&lt;/code&gt;, and &lt;code&gt;o&lt;/code&gt; pinch shut or produce self-intersecting subpaths.&lt;/li&gt;
&lt;li&gt;Clean 12-point icons inflate into &lt;code&gt;400+&lt;/code&gt; noisy anchor points that stall vinyl plotters and bloat web bundles.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Inspecting Any SVG in the Browser (Zero Server Upload)
&lt;/h2&gt;

&lt;p&gt;When we built the pre-flight inspector for &lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib&lt;/a&gt;, we wrote a small pure-TypeScript DOM audit that runs locally in the browser via &lt;code&gt;DOMParser&lt;/code&gt; (&lt;code&gt;image/svg+xml&lt;/code&gt;). Here is the core check pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;auditLogoSvg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawSvg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DOMParser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parseFromString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawSvg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'image/svg+xml'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;documentElement&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;liveTextNodes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'text, tspan, textPath'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;embeddedRasters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'image'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;vectorPrimitives&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'path, circle, rect, ellipse, polygon, polyline'&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;hasViewBox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'viewBox'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;hasNaNPaths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'path'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="n"&gt;bNaN&lt;/span&gt;\&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'d'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;liveTextNodes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;// Must be 0 for print-ready outlined SVG&lt;/span&gt;
    &lt;span class="n"&gt;embeddedRasters&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;    &lt;span class="c1"&gt;// Must be 0 (catches fake wrapped-PNG SVGs)&lt;/span&gt;
    &lt;span class="n"&gt;vectorPrimitives&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;// Should be &amp;gt; 0 real geometry elements&lt;/span&gt;
    &lt;span class="n"&gt;hasViewBox&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;// Required for predictable scaling&lt;/span&gt;
    &lt;span class="n"&gt;hasNaNPaths&lt;/span&gt;         &lt;span class="c1"&gt;// Catches malformed path coordinates&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One important browser security detail if you build your own SVG tool: &lt;strong&gt;never&lt;/strong&gt; render untrusted user SVGs via &lt;code&gt;innerHTML&lt;/code&gt;, &lt;code&gt;{@html}&lt;/code&gt;, or a same-origin &lt;code&gt;image/svg+xml&lt;/code&gt; Blob URL (inline &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags and &lt;code&gt;onload&lt;/code&gt; handlers execute inside SVG documents). Instead, strip scripts/event handlers first and rasterize the preview onto an offscreen &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; before emitting a safe &lt;code&gt;image/png&lt;/code&gt; Blob URL.&lt;/p&gt;




&lt;h2&gt;
  
  
  The 6-Point Pre-Flight Checklist Before Sending a Logo to Print
&lt;/h2&gt;

&lt;p&gt;Before uploading your logo to a printer, merch vendor, or sign shop, check all six items:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Zero &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; tags&lt;/strong&gt; — confirm every letter is an outlined &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero &lt;code&gt;&amp;lt;image&amp;gt;&lt;/code&gt; embeds&lt;/strong&gt; — confirm the SVG is not a wrapped PNG.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explicit &lt;code&gt;viewBox&lt;/code&gt; attribute&lt;/strong&gt; — ensures crisp proportional scaling across web, PDF, and print RIPs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pure monochrome variants&lt;/strong&gt; — export &lt;code&gt;#111111&lt;/code&gt; pure-black (for invoices, stamps, and laser engraving) and &lt;code&gt;#FFFFFF&lt;/code&gt; pure-white (for dark headers and packaging).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-resolution transparent PNG backup&lt;/strong&gt; — export at &lt;code&gt;2048px–4000px&lt;/code&gt; wide for Stripe Checkout, slide decks, and social headers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CMYK Total Area Coverage &lt;code&gt;&amp;lt;= 300%&lt;/code&gt; + WCAG 2.1 contrast&lt;/strong&gt; — avoids wet-ink smudging on coated paper stocks and unreadable web badges.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Free No-Signup Browser Tools to Run These Checks Today
&lt;/h2&gt;

&lt;p&gt;If you already have a logo SVG and want to audit or recolor it right now without installing Illustrator or creating an account, all of our pre-press utilities run 100% locally in your browser:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/svg-font-outline-checker" rel="noopener noreferrer"&gt;SVG Font Outline &amp;amp; Pre-Press Checker&lt;/a&gt;&lt;/strong&gt; — detects live &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; tags, fake wrapped-PNG &lt;code&gt;&amp;lt;image&amp;gt;&lt;/code&gt; embeds, missing &lt;code&gt;viewBox&lt;/code&gt;, and &lt;code&gt;NaN&lt;/code&gt; path bugs in one click.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/svg-color-recolor" rel="noopener noreferrer"&gt;SVG Logo Color Changer &amp;amp; Monochrome Generator&lt;/a&gt;&lt;/strong&gt; — converts any SVG into pure black, pure white, or custom brand colors with live CMYK/WCAG contrast and a 3-variant ZIP export.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/svg-to-png" rel="noopener noreferrer"&gt;SVG to 4K Transparent PNG Converter&lt;/a&gt;&lt;/strong&gt; — exports crisp &lt;code&gt;2048px&lt;/code&gt; or &lt;code&gt;4000px&lt;/code&gt; transparent PNGs locally.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/hex-to-cmyk-wcag" rel="noopener noreferrer"&gt;HEX to CMYK &amp;amp; WCAG 2.1 Print Checker&lt;/a&gt;&lt;/strong&gt; — calculates print CMYK formulas and flags ink coverage above &lt;code&gt;300%&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the full engineering breakdown—including DPI print-size tables and a side-by-side comparison of bitmap tracing vs manual redraw vs native OpenType outlining—read the complete guide: &lt;strong&gt;&lt;a href="https://www.logonib.com/guides/convert-png-to-vector-svg" rel="noopener noreferrer"&gt;How to Convert a PNG or AI Logo to Print-Ready Vector SVG&lt;/a&gt;&lt;/strong&gt; (and if you are rebuilding an AI raster logo from scratch, see our &lt;strong&gt;&lt;a href="https://www.logonib.com/alternatives/chatgpt-logo-maker" rel="noopener noreferrer"&gt;ChatGPT / AI Logo vs Outlined Vector SVG guide&lt;/a&gt;&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;Need a brand-new outlined vector logo and full brand kit without a subscription? You can test &lt;strong&gt;&lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib Studio&lt;/a&gt;&lt;/strong&gt; free on your own company name—and even download a &lt;strong&gt;&lt;a href="https://www.logonib.com/#specs" rel="noopener noreferrer"&gt;free 8-file Alder &amp;amp; Pine sample ZIP&lt;/a&gt;&lt;/strong&gt; first to inspect the outlined SVGs, 300-DPI bleed PDF, and 4-page brand guide yourself. One-time packs start at &lt;code&gt;$29&lt;/code&gt; with zero recurring fees and a 30-day refund guarantee.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>design</category>
      <category>javascript</category>
      <category>svg</category>
    </item>
    <item>
      <title>Why opentype.js 2.0's toPathData() Silently Emits NaN (and How We Fixed Outlined SVG + PDF Exports in the Browser)</title>
      <dc:creator>Hazel Fenwick</dc:creator>
      <pubDate>Mon, 30 Nov 2026 13:59:38 +0000</pubDate>
      <link>https://dev.to/hazelfenwick/why-opentypejs-20s-topathdata-silently-emits-nan-and-how-we-fixed-outlined-svg-pdf-exports-1ib9</link>
      <guid>https://dev.to/hazelfenwick/why-opentypejs-20s-topathdata-silently-emits-nan-and-how-we-fixed-outlined-svg-pdf-exports-1ib9</guid>
      <description>&lt;p&gt;If you use &lt;code&gt;opentype.js@2.0.0&lt;/code&gt; to convert TrueType/OpenType text into outlined SVG &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; elements, run this four-line snippet in Node or your browser console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;524.0000001&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;intPart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;decPart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;intPart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;decPart&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"e+"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"-&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;decPart&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"e+"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// 9.999996564147295e-8e+2 -&amp;gt; NaN&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That exact string-concatenation rounding trick lives inside &lt;code&gt;opentype.js@2.0.0&lt;/code&gt;'s &lt;code&gt;Path.prototype.toPathData()&lt;/code&gt; helper (&lt;code&gt;src/path.mjs&lt;/code&gt;), and it silently writes literal &lt;code&gt;NaN&lt;/code&gt; coordinates into SVG &lt;code&gt;d="..."&lt;/code&gt; attributes whenever a glyph vertex lands within &lt;code&gt;1e-6&lt;/code&gt; above an integer.&lt;/p&gt;

&lt;p&gt;We hit this bug in production while building &lt;strong&gt;&lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib&lt;/a&gt;&lt;/strong&gt; — a browser-native vector logo and print-ready brand kit studio that compiles outlined SVGs, 4K PNGs, and pure-vector 300-DPI print PDFs entirely on the client. Here is the exact root cause, the 20-line fix we shipped, and how we regression-test every bundled &lt;code&gt;.ttf&lt;/code&gt; font before export.&lt;/p&gt;




&lt;h2&gt;
  
  
  How We Caught It: &lt;code&gt;fraunces-600.ttf&lt;/code&gt; Crashing &lt;code&gt;pdf-lib&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Most online logo makers either hand you raster PNGs or export SVGs containing raw &lt;code&gt;&amp;lt;text font-family="..."&amp;gt;&lt;/code&gt; tags. The moment a founder sends that SVG to a print shop or opens it in Illustrator without the font installed, the wordmark silently falls back to Arial or Times New Roman.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib&lt;/a&gt;, we eliminate missing-font bugs completely by running deterministic glyph outlining in the browser:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fetch the exact &lt;code&gt;.ttf&lt;/code&gt; font binary (&lt;code&gt;Inter&lt;/code&gt;, &lt;code&gt;Syne&lt;/code&gt;, &lt;code&gt;Fraunces&lt;/code&gt;, &lt;code&gt;Playfair Display&lt;/code&gt;, &lt;code&gt;Space Grotesk&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;Measure kerning, tracking, and bounding boxes with &lt;code&gt;opentype.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Convert every letterform directly to vector Bezier &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; commands (zero &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; tags, zero external font links)&lt;/li&gt;
&lt;li&gt;Compile those exact same &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; primitives straight into PDF vector drawing operators via &lt;code&gt;pdf-lib&lt;/code&gt; (generating infinite-resolution vector logo PDFs, a 4-page CMYK/WCAG brand style guide, and &lt;code&gt;3.75" x 2.25"&lt;/code&gt; full-bleed &lt;code&gt;0.125"&lt;/code&gt; business card PDFs with crop marks)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Everything worked on &lt;code&gt;Inter&lt;/code&gt;, &lt;code&gt;Syne&lt;/code&gt;, and &lt;code&gt;Space Grotesk&lt;/code&gt; — until we generated a live specimen ZIP for &lt;strong&gt;"Alder &amp;amp; Pine"&lt;/strong&gt; set in &lt;strong&gt;&lt;code&gt;Fraunces&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;fraunces-600.ttf&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The exported SVG silently contained &lt;code&gt;NaN&lt;/code&gt; inside a curve command. Browsers quietly skipped the malformed segment, making it nearly invisible at a glance — until &lt;code&gt;pdf-lib&lt;/code&gt; tried to parse the SVG path into PDF operators and threw immediately.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Exact Root Cause in &lt;code&gt;opentype.js@2.0.0&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Digging into &lt;code&gt;node_modules/opentype.js/dist/opentype.js&lt;/code&gt; (&lt;code&gt;src/path.mjs&lt;/code&gt;), &lt;code&gt;Path.prototype.toPathData()&lt;/code&gt; delegates every coordinate to &lt;code&gt;roundDecimal()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;decimalRoundingCache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;roundDecimal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;integerPart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;float&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;decimalPart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;float&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;integerPart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;decimalRoundingCache&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;decimalRoundingCache&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;decimalRoundingCache&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimalPart&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;roundedDecimalPart2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;decimalRoundingCache&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimalPart&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;integerPart&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;roundedDecimalPart2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;roundedDecimalPart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;decimalPart&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"e+"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"e-"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;decimalRoundingCache&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;places&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimalPart&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;roundedDecimalPart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;integerPart&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;roundedDecimalPart&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is the failure chain when floating-point glyph scaling lands just above an integer (for example &lt;code&gt;524.0000001&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;integerPart = Math.floor(524.0000001)&lt;/code&gt; -&amp;gt; &lt;code&gt;524&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;decimalPart = 524.0000001 - 524&lt;/code&gt; -&amp;gt; &lt;code&gt;9.999996564147295e-8&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Because &lt;code&gt;decimalPart &amp;lt; 1e-6&lt;/code&gt;, JavaScript serializes it in &lt;strong&gt;scientific notation&lt;/strong&gt; with an existing &lt;code&gt;e-8&lt;/code&gt; exponent.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;decimalPart + "e+" + 2&lt;/code&gt; produces &lt;strong&gt;&lt;code&gt;"9.999996564147295e-8e+2"&lt;/code&gt;&lt;/strong&gt; — a string with &lt;strong&gt;two exponents&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Math.round("9.999996564147295e-8e+2")&lt;/code&gt; returns &lt;strong&gt;&lt;code&gt;NaN&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;decimalRoundingCache[2][decimalPart] = NaN&lt;/code&gt; &lt;strong&gt;caches the &lt;code&gt;NaN&lt;/code&gt; permanently&lt;/strong&gt; for the lifetime of the runtime.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Any scaled glyph coordinate whose fractional part falls in &lt;code&gt;(0, 1e-6)&lt;/code&gt; corrupts the entire SVG path string — and because font scaling (&lt;code&gt;fontSize / unitsPerEm&lt;/code&gt;) produces arbitrary IEEE-754 floats, hitting that window is purely a matter of font size and glyph offsets.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Fix: Serialize &lt;code&gt;path.commands&lt;/code&gt; Directly with Finite Guards
&lt;/h2&gt;

&lt;p&gt;The raw geometric commands on &lt;code&gt;path.commands&lt;/code&gt; (&lt;code&gt;M&lt;/code&gt;, &lt;code&gt;L&lt;/code&gt;, &lt;code&gt;Q&lt;/code&gt;, &lt;code&gt;C&lt;/code&gt;, &lt;code&gt;Z&lt;/code&gt;) are still clean, finite IEEE-754 numbers. Bypassing &lt;code&gt;toPathData()&lt;/code&gt; and serializing &lt;code&gt;path.commands&lt;/code&gt; directly with numeric rounding (&lt;code&gt;Math.round(n * 100) / 100&lt;/code&gt;) and &lt;code&gt;Number.isFinite()&lt;/code&gt; checks eliminates both the double-exponent &lt;code&gt;NaN&lt;/code&gt; bug and any surprise &lt;code&gt;optimizeCommands&lt;/code&gt; mutations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s1"&gt;'0'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;serializeOpenTypePath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;OpenTypePath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;commands&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toPathData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'M'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'L'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${cmd.type}${fmt(cmd.x!)} ${fmt(cmd.y!)}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'Q'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Q${fmt(cmd.x1!)} ${fmt(cmd.y1!)} ${fmt(cmd.x!)} ${fmt(cmd.y!)}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'C'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
        &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
          &lt;span class="sb"&gt;`C${fmt(cmd.x1!)} ${fmt(cmd.y1!)} ${fmt(cmd.x2!)} ${fmt(cmd.y2!)} ${fmt(cmd.x!)} ${fmt(cmd.y!)}`&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'Z'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Z'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we added a Vitest regression suite that loops through &lt;strong&gt;every bundled &lt;code&gt;.ttf&lt;/code&gt; font&lt;/strong&gt; in LogoNib, compiles both the outlined SVG and the pure-vector PDF with &lt;code&gt;pdf-lib&lt;/code&gt;, and asserts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outlined&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;brandPathD&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toContain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'NaN'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outlined&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;taglinePathD&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toContain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'NaN'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outlined&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toContain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'NaN'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outlined&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;svg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toContain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'&amp;lt;text'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pdfBytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;buildVectorLogoPdf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outlined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;concept&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'color'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;TextDecoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pdfBytes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subarray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'%PDF-'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All 35 unit tests pass cleanly across every font weight and layout variant.&lt;/p&gt;




&lt;h2&gt;
  
  
  Inspect the Output Yourself (Zero Sign-Up)
&lt;/h2&gt;

&lt;p&gt;If you want to verify the actual outlined SVGs and vector PDFs produced by this pipeline in Illustrator, Inkscape, Figma, or Ghostscript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Download a real 8-file production ZIP (&lt;code&gt;alder-and-pine-sample.zip&lt;/code&gt;)&lt;/strong&gt; — click &lt;strong&gt;"Download Sample ZIP (Alder &amp;amp; Pine)"&lt;/strong&gt; at &lt;strong&gt;&lt;a href="https://www.logonib.com/#specs" rel="noopener noreferrer"&gt;logonib.com/#specs&lt;/a&gt;&lt;/strong&gt; (generated client-side on demand with zero email or account required — includes the exact &lt;code&gt;Fraunces&lt;/code&gt; outlined SVGs, 4000px transparent PNG, 300-DPI vector logo PDF, 4-page brand guidelines PDF, and &lt;code&gt;3.5" x 2"&lt;/code&gt; bleed business card PDF).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Try the live Wireframe path inspector&lt;/strong&gt; — enter any project name at &lt;strong&gt;&lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;logonib.com&lt;/a&gt;&lt;/strong&gt; with no signup, open the studio, and toggle &lt;strong&gt;Wireframe&lt;/strong&gt; to inspect every SVG primitive directly on the drafting canvas.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;4 free standalone client-side utilities (&lt;a href="https://www.logonib.com/tools" rel="noopener noreferrer"&gt;logonib.com/tools&lt;/a&gt;)&lt;/strong&gt; — while building the studio export engine, we also broke out four zero-upload browser tools free for everyone:

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.logonib.com/tools/hex-to-cmyk-wcag" rel="noopener noreferrer"&gt;HEX to CMYK &amp;amp; WCAG 2.1 Contrast Lab&lt;/a&gt; (with &amp;gt;300% total ink coverage pre-press alerts)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.logonib.com/tools/favicon-generator" rel="noopener noreferrer"&gt;Binary Multi-Size Favicon (&lt;code&gt;.ICO&lt;/code&gt; + PWA) Generator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.logonib.com/tools/svg-to-png" rel="noopener noreferrer"&gt;4K SVG-to-PNG Converter &amp;amp; Path Inspector&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.logonib.com/tools/social-media-logo-resizer" rel="noopener noreferrer"&gt;12-Preset Social Media Logo Resizer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Designing, inspecting wireframes, downloading the sample ZIP, and using all four utilities are completely free; if you want to export a commercial vector kit for a brand, LogoNib uses strictly one-time pricing (&lt;code&gt;$29-$89&lt;/code&gt;, no subscriptions, 30-day money-back guarantee).&lt;/p&gt;

&lt;p&gt;If you spot any edge cases in the outlined SVG paths or vector PDF output — or have hit other surprising floating-point bugs in &lt;code&gt;opentype.js&lt;/code&gt; — let me know in the comments!&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Outlining OpenType Fonts into SVG Paths &amp; 300-DPI Print PDFs in the Browser</title>
      <dc:creator>Hazel Fenwick</dc:creator>
      <pubDate>Sun, 29 Nov 2026 14:56:14 +0000</pubDate>
      <link>https://dev.to/hazelfenwick/outlining-opentype-fonts-into-svg-paths-300-dpi-print-pdfs-in-the-browser-2cd9</link>
      <guid>https://dev.to/hazelfenwick/outlining-opentype-fonts-into-svg-paths-300-dpi-print-pdfs-in-the-browser-2cd9</guid>
      <description>&lt;p&gt;If you have ever exported an &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; from a web tool and opened it in Adobe Illustrator, Inkscape, or a commercial print RIP, you have probably seen a painful failure mode: the logo wordmark silently snaps back to Arial or Times New Roman.&lt;/p&gt;

&lt;p&gt;The reason is simple: &lt;code&gt;&amp;lt;text font-family="Plus Jakarta Sans"&amp;gt;Acme&amp;lt;/text&amp;gt;&lt;/code&gt; only works when that exact font binary is installed locally on the viewer's machine. Web fonts loaded over &lt;code&gt;@font-face&lt;/code&gt; do not travel inside a standalone &lt;code&gt;.svg&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;While building &lt;a href="https://www.logonib.com" rel="noopener noreferrer"&gt;LogoNib&lt;/a&gt;, a browser-based vector logo and brand kit studio, I had to make sure every exported SVG, PDF, and PNG matched pixel-for-pixel across browsers, Figma, Illustrator, and commercial offset printers — without requiring native C++ servers or recurring subscriptions.&lt;/p&gt;

&lt;p&gt;Here are the four concrete engineering problems we had to solve in TypeScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Converting &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; to mathematical &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; outlines with OpenType.js
&lt;/h2&gt;

&lt;p&gt;Instead of shipping &lt;code&gt;&amp;lt;text&amp;gt;&lt;/code&gt; nodes in production SVGs, we load the actual &lt;code&gt;.ttf&lt;/code&gt;/&lt;code&gt;.otf&lt;/code&gt; font buffer and compile every glyph in the wordmark and tagline into vector Bezier commands using OpenType glyph outlining:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compute exact glyph advance widths, kerning pairs, and letter-spacing offsets manually so tracking matches the live CSS preview.&lt;/li&gt;
&lt;li&gt;Measure the combined tight bounding box &lt;code&gt;(x1, y1, x2, y2)&lt;/code&gt; across all outlined paths (not the font's nominal ascender/descender box) so vertical centering against a geometric emblem looks optically balanced.&lt;/li&gt;
&lt;li&gt;Round path coordinates cleanly to 2 decimal places (&lt;code&gt;14.25&lt;/code&gt;) to keep file sizes small without introducing curve jitter at 4000px or large-format signage scales.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is an outlined SVG that has &lt;strong&gt;zero external font dependencies&lt;/strong&gt; — you can email it straight to a screen printer or embroiderer and every curve stays locked.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Keeping dual SVG outputs: Outlined vs. Editable Source
&lt;/h2&gt;

&lt;p&gt;Print vendors need outlined paths, while web developers sometimes want an editable file they can tweak later. Shipping both inside one ZIP (&lt;code&gt;brand-outlined.svg&lt;/code&gt; and &lt;code&gt;brand-editable.svg&lt;/code&gt;) solves both workflows cleanly.&lt;/p&gt;

&lt;p&gt;Even more useful for user trust: rendering a &lt;strong&gt;Wireframe Outline Mode&lt;/strong&gt; right on the live canvas (&lt;code&gt;fill: none; stroke: #0B4DA2; vector-effect: non-scaling-stroke&lt;/code&gt;) lets users inspect the actual SVG primitives and path counts before exporting, proving the mark is true vector geometry rather than a PNG stuffed inside an &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; wrapper.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Pre-press math: 300 DPI bleed, trim marks, and CMYK ink limits
&lt;/h2&gt;

&lt;p&gt;Screen colors (&lt;code&gt;#RGB&lt;/code&gt;) and print inks (&lt;code&gt;CMYK&lt;/code&gt;) fail in subtle ways if you ignore print physics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Full-bleed geometry:&lt;/strong&gt; A standard US business card trims to &lt;code&gt;3.5" × 2.0"&lt;/code&gt;, which means the print artwork must extend &lt;code&gt;0.125"&lt;/code&gt; past every edge (&lt;code&gt;3.75" × 2.25"&lt;/code&gt;, or &lt;code&gt;1125 × 675 px&lt;/code&gt; at 300 DPI) with a &lt;code&gt;0.125"&lt;/code&gt; interior safe margin so guillotine variance never leaves a white sliver.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Total Area Coverage (TAC):&lt;/strong&gt; Naive RGB-to-CMYK conversion of rich darks can push &lt;code&gt;C + M + Y + K&lt;/code&gt; above &lt;code&gt;300%&lt;/code&gt;, causing wet ink smudging and slow drying on uncoated paper stocks. Clamping or flagging &amp;gt;300% ink coverage catches print defects early.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contrast verification:&lt;/strong&gt; Computing relative luminance and WCAG 2.1 contrast ratios (&lt;code&gt;&amp;gt;= 4.5:1&lt;/code&gt; AA normal text, &lt;code&gt;&amp;gt;= 3.0:1&lt;/code&gt; large text / UI icons) automatically checks dark-on-light and light-on-dark lockups before anyone ships a low-contrast brand palette.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We documented all of these exact tolerances — including minimum stroke weights for embroidery and favicon pixel grids — in an interactive &lt;a href="https://www.logonib.com/guides/vector-logo-print-spec" rel="noopener noreferrer"&gt;Pre-Press Vector Logo Spec Sheet&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Packaging multi-format brand kits &amp;amp; free standalone tools in the browser
&lt;/h2&gt;

&lt;p&gt;Using client-side Canvas rasterization, binary ICO packing (&lt;code&gt;16px&lt;/code&gt;, &lt;code&gt;32px&lt;/code&gt;, &lt;code&gt;48px&lt;/code&gt; frames in a single &lt;code&gt;.ico&lt;/code&gt; container), PDF vector drawing, and in-memory ZIP bundling means the entire brand kit exports instantaneously in the browser with near-zero server cost.&lt;/p&gt;

&lt;p&gt;Because several of these utilities are helpful even when you already have a logo, we extracted four of them into standalone, zero-signup free tools at &lt;a href="https://www.logonib.com/tools" rel="noopener noreferrer"&gt;logonib.com/tools&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/hex-to-cmyk-wcag" rel="noopener noreferrer"&gt;HEX to CMYK &amp;amp; WCAG 2.1 Lab&lt;/a&gt;&lt;/strong&gt; — live RGB/HSL/CMYK conversion with &amp;gt;300% ink warnings and contrast checks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/favicon-generator" rel="noopener noreferrer"&gt;Multi-Size Favicon Generator&lt;/a&gt;&lt;/strong&gt; — builds a real multi-frame &lt;code&gt;favicon.ico&lt;/code&gt;, Apple Touch icon, PWA icons, and &lt;code&gt;site.webmanifest&lt;/code&gt; ZIP&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/svg-to-png" rel="noopener noreferrer"&gt;4K SVG to PNG Converter &amp;amp; Path Inspector&lt;/a&gt;&lt;/strong&gt; — inspects SVG node counts safely and exports crisp transparent PNGs up to 4000px&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.logonib.com/tools/social-media-logo-resizer" rel="noopener noreferrer"&gt;Social Media Logo Resizer&lt;/a&gt;&lt;/strong&gt; — exports 12 exact platform dimensions (X, LinkedIn, Instagram, YouTube, GitHub, Discord, Open Graph) with circular crop safe-zone guides&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are building vector export pipelines in TypeScript or wrestling with print-ready PDFs from web apps, drop a comment below — happy to share implementation details!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>svg</category>
      <category>design</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
