@openpresentation/opf-render 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/svg.js +7 -6
  2. package/package.json +7 -7
package/dist/svg.js CHANGED
@@ -13,14 +13,15 @@ import {
13
13
  import {
14
14
  hasContentVariables,
15
15
  isTemplate,
16
+ resolveDrawnFontFamilies,
16
17
  resolveSlideContext,
17
18
  resolveVariables,
18
19
  validate
19
20
  } from "@openpresentation/opf";
20
21
  import { adjustedFontSize, baselineShift, createScriptFonts } from "./script-fonts.js";
21
- import { disabledFeaturesStyle } from "./font-compatibility.js";
22
22
  import { isSymbolEncodedFamily } from "./symbol-fonts.js";
23
23
  import { fontPolicyFor } from "@openpresentation/opf/font-policy";
24
+ import { disabledFeaturesStyle } from "./font-compatibility.js";
24
25
  import { isDatasetChart, isDatasetTable, renderCatalogChart } from "./charts.js";
25
26
  import { renderCaption, renderFootnotes } from "./annotations.js";
26
27
  import { drawnFaces } from "./drawn-faces.js";
@@ -598,10 +599,9 @@ function bindSlide(presentation, index, context) {
598
599
  // A symbol-encoded family (Symbol, Wingdings, Webdings; FF-45) keeps its name too: each run resolves it again and the script-font planner
599
600
  // maps the run's private-use codes through the symbol table (symbol-fonts.js), as it does for a symbol run. Resolving the role to the open
600
601
  // symbol face here would drop the encoding, and the codes would reach a face with no glyph for them (missing-glyph).
601
- for (const role of ["heading","body","code","accent"]) if (design.fonts[role] !== undefined) {
602
- const named = design.fonts[role], resolved = resolveTextStyle({fontFamily:named,fontWeight:role === "heading" ? 700 : 400},textMeasurement).fontFamily;
603
- design.fonts[role] = isSymbolEncodedFamily(named) || fontPolicyFor(named)?.replacement?.weight !== undefined && resolved.toLowerCase() !== named.toLowerCase() ? named : resolved;
604
- }
602
+ // The rule is core's resolveDrawnFontFamilies, which validate and paginate compose with too (WI-1, P24); the renderer decides
603
+ // the two exceptions from the font policy and symbol tables it already holds.
604
+ design.fonts = resolveDrawnFontFamilies(design.fonts, textMeasurement, (named, resolved) => isSymbolEncodedFamily(named) || fontPolicyFor(named)?.replacement?.weight !== undefined && resolved.toLowerCase() !== named.toLowerCase());
605
605
  const geometry = composeSlide(slide, { ...slideContext.options, fontFamilies: design.fonts, textRasterPadding:context.options.textRasterPadding, textMeasurement });
606
606
  return {
607
607
  scriptFonts,
@@ -1001,7 +1001,8 @@ function listEntriesSvg(item, fit, bound, options) {
1001
1001
  // design.listBullet=image: core attaches the icon logo as item.bulletImage and its box (entry.bulletBox: 0.65 em, as PowerPoint draws a:buBlip). An icon that cannot be drawn keeps the glyph marker.
1002
1002
  const bullet=item.bulletImage?resolveBulletImage(item.bulletImage,bound,options):undefined;
1003
1003
  for(const entry of fit.listEntries){
1004
- if(bullet){const box=entry.bulletBox??{x:entry.marker.x,y:entry.marker.y-entry.marker.fontSize*.65,width:entry.marker.fontSize*.65,height:entry.marker.fontSize*.65};children.push(tag('image',{x:stableNumber(box.x),y:stableNumber(box.y),width:stableNumber(box.width),height:stableNumber(box.height),href:bullet,preserveAspectRatio:'xMidYMid meet','aria-hidden':'true',...(options.trace?{'data-opf-generated':'true'}:{})}));}
1004
+ if(entry.marker.none){/* design.listBullet: none draws no marker */}
1005
+ else if(bullet){const box=entry.bulletBox??{x:entry.marker.x,y:entry.marker.y-entry.marker.fontSize*.65,width:entry.marker.fontSize*.65,height:entry.marker.fontSize*.65};children.push(tag('image',{x:stableNumber(box.x),y:stableNumber(box.y),width:stableNumber(box.width),height:stableNumber(box.height),href:bullet,preserveAspectRatio:'xMidYMid meet','aria-hidden':'true',...(options.trace?{'data-opf-generated':'true'}:{})}));}
1005
1006
  else children.push(tag('text',{x:stableNumber(entry.marker.x),y:stableNumber(entry.marker.y),'font-family':fontStack(entry.marker.style.fontFamily,bound.design.fontScheme.type),'font-size':stableNumber(entry.marker.fontSize),...numberMarkerStyle(entry.marker),fill:bound.design.colors.text,'aria-hidden':'true',...(entry.marker.anchor==='end'?{'text-anchor':'end'}:{})},escapeText(entry.marker.text)));
1006
1007
  const config={path:entry.textPath,align:'left',fill:bound.design.colors.text,rich:Array.isArray(entry.value),options};
1007
1008
  children.push(renderRichLines(typeof entry.value==='string'?[entry.value]:entry.value,entry.text,entry.textBox,bound,config));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpresentation/opf-render",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Deterministic local OPF renderer for SVG, PNG, and PDF output.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -92,9 +92,9 @@
92
92
  "dependencies": {
93
93
  "bidi-js": "1.1.0",
94
94
  "fontkit": "^2.0.4",
95
- "harfbuzzjs": "1.6.3",
95
+ "harfbuzzjs": "1.6.4",
96
96
  "pako": "3.0.2",
97
- "@openpresentation/opf": "^0.27.0"
97
+ "@openpresentation/opf": "^0.28.0"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@expo-google-fonts/arimo": "0.4.3",
@@ -335,15 +335,15 @@
335
335
  "@expo-google-fonts/tinos": "0.4.2",
336
336
  "@hyzyla/pdfium": "2.1.13",
337
337
  "@jspawn/qpdf-wasm": "0.0.2",
338
- "@napi-rs/canvas": "1.0.11",
338
+ "@napi-rs/canvas": "1.0.13",
339
339
  "@resvg/resvg-js": "2.6.2",
340
340
  "axe-core": "4.14.0",
341
341
  "esbuild": "0.28.2",
342
342
  "pdf-lib": "1.17.1",
343
343
  "pdfjs-dist": "6.4.299",
344
- "playwright": "1.64.0",
344
+ "playwright": "1.64.1",
345
345
  "sharp": "0.35.5",
346
- "@openpresentation/gallery": "0.27.0"
346
+ "@openpresentation/gallery": "0.28.0"
347
347
  },
348
348
  "bin": {
349
349
  "opf-preview-fonts": "./dist/preview-fonts-cli.js"
@@ -399,5 +399,5 @@
399
399
  "test:preview-a11y-browser": "node test/preview-a11y-browser.mjs",
400
400
  "test:forced-colors-browser": "node test/forced-colors-browser.mjs artifacts/forced-colors"
401
401
  },
402
- "gitHead": "f90536d0e9a7a16b25aa718e03ced4e00a7316e1"
402
+ "gitHead": "abc56634a584db38a305a27edc3bc76b4116637b"
403
403
  }