Source fork of emf-converter@2.0.2
(Apache-2.0, ChristopherVR/emf-converter)
used by @mlightcad/data-model to rasterize OLE2FRAME WMF/EMF previews.
Upstream tag: v2.0.2 (460b4fc).
EMR_EXTSELECTCLIPRGN (src/emf-gdi-draw-text-bitmap.ts) — clip rects
use device/page space instead of the GDI world transform, so Excel OLE
ExtTextOut glyphs are not clipped away.EMR_EXTCREATEFONTINDIRECTW (src/emf-gdi-object-handlers.ts) —
LOGFONTW.lfFaceName is read at byte offset 32 (not 28), matching the
Windows structure so CJK face remapping works.pnpm add @mlightcad/emf-converter
Same public API as upstream 2.0.2:
import {
convertEmfToDataUrl,
convertWmfToDataUrl
} from '@mlightcad/emf-converter'
const pngDataUrl = await convertEmfToDataUrl(arrayBuffer, {
maxWidth: 4096,
maxHeight: 4096,
dpiScale: 1,
fontFamilyMap: { simsun: '"Microsoft YaHei", sans-serif' }
})
@mlightcad/data-model statically imports this package and inlines it into
its published CJS bundle.
pnpm --filter @mlightcad/emf-converter build
pnpm --filter @mlightcad/emf-converter test