gum-jsx 1.2.2 → 1.2.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gum-jsx",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Language for vector graphics generation.",
5
5
  "type": "module",
6
6
  "author": "Douglas Hanley",
package/src/gum.js CHANGED
@@ -601,6 +601,10 @@ function resizer(lim_in, lim_out) {
601
601
  }
602
602
  }
603
603
 
604
+ function rotate_repr(rotate, x, y, prec = D.prec) {
605
+ return `rotate(${rounder(rotate, prec)}, ${rounder(x, prec)}, ${rounder(y, prec)})`
606
+ }
607
+
604
608
  // context holds the current pixel rect and other global settings
605
609
  // map() will create a new sub-context using rect in coord space
606
610
  // map*() functions map from coord to pixel space (in prect)
@@ -673,7 +677,7 @@ class Context {
673
677
 
674
678
  // rotate rect inside
675
679
  const [ w, h ] = rotate_rect([ w0, h0 ], rotate, { aspect, expand, invar })
676
- const transform = (rotate != null && rotate != 0) ? `rotate(${rotate}, ${x0}, ${y0})` : null
680
+ const transform = (rotate != null && rotate != 0) ? rotate_repr(rotate, x0, y0, this.prec) : null
677
681
 
678
682
  // broadcast align into [ halign, valign ] components
679
683
  const [ hafrac, vafrac ] = ensure_vector(align, 2).map(align_frac)
package/src/text.js CHANGED
@@ -13,14 +13,14 @@ import { CONSTANTS as C, DEFAULTS as D } from './defaults.js'
13
13
 
14
14
  async function getFontPaths() {
15
15
  if (is_browser()) {
16
- const { default: sans } = await import('./fonts/IBMPlexSans-Variable.ttf')
17
- const { default: mono } = await import('./fonts/IBMPlexMono-Regular.ttf')
18
- const { default: moji } = await import(/* @vite-ignore */ './fonts/NotoColorEmoji-Regular.ttf')
16
+ const { default: sans } = await import('./fonts/IBMPlexSans-Variable.ttf?url')
17
+ const { default: mono } = await import('./fonts/IBMPlexMono-Regular.ttf?url')
18
+ const { default: moji } = await import(/* @vite-ignore */ './fonts/NotoColorEmoji-Regular.ttf?url')
19
19
  return { sans, mono, moji }
20
20
  } else {
21
21
  return {
22
- sans: new URL('./fonts/IBMPlexSans-Variable.ttf', import.meta.url).pathname,
23
- mono: new URL('./fonts/IBMPlexMono-Regular.ttf', import.meta.url).pathname,
22
+ sans: new URL(/* @vite-ignore */ './fonts/IBMPlexSans-Variable.ttf', import.meta.url).pathname,
23
+ mono: new URL(/* @vite-ignore */ './fonts/IBMPlexMono-Regular.ttf', import.meta.url).pathname,
24
24
  moji: new URL(/* @vite-ignore */ './fonts/NotoColorEmoji-Regular.ttf', import.meta.url).pathname,
25
25
  }
26
26
  }
@@ -33,7 +33,7 @@ async function loadFont(path) {
33
33
  const arrayBuffer = await response.arrayBuffer()
34
34
  return opentype.parse(arrayBuffer)
35
35
  } else {
36
- const fs = await import('fs/promises')
36
+ const fs = await import(/* @vite-ignore */ 'fs/promises')
37
37
  const { buffer} = await fs.readFile(path)
38
38
  return opentype.parse(buffer)
39
39
  }