ntk 8.12.9 → 8.12.10

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.
@@ -5,9 +5,12 @@ import { drawGlyphRuns } from './glyphs.js';
5
5
  import { embeddingLevels, normalizedLevels, reorderRuns } from './shape.js';
6
6
  import { worthKeeping } from './paragraphs.js';
7
7
 
8
- const WS = new Set([0x20, 0x09, 0xa0]);
8
+ // The white space a line may end on and hang past its edge: spaces and tabs,
9
+ // as CSS hangs them. A no-break space is not one — CSS measures it, and
10
+ // ` ` at the end of a cell or a span is there to take room.
11
+ const WS = new Set([0x20, 0x09]);
9
12
  const HARD_BREAKS = /[\n\r\u2028\u2029]+$/;
10
- const TRAILING_WS = /[ \t\u00a0]+$/;
13
+ const TRAILING_WS = /[ \t]+$/;
11
14
 
12
15
  function isWsGlyph(g) {
13
16
  return g.codePoints.length > 0 && g.codePoints.every((cp) => WS.has(cp));
package/lib/text/shape.js CHANGED
@@ -104,18 +104,16 @@ function spacedFeatures(features) {
104
104
  /**
105
105
  * Space a shaped run's glyphs apart by `spacing` px: added to the advance of
106
106
  * every glyph that has one, so a combining mark keeps sitting on its base.
107
- * An rtl run stores its glyphs in visual order, and its spacing belongs on
108
- * the *reading* side of each glyph — the left — so there the glyph is drawn
109
- * that much further along its advance as well.
107
+ * The gap is on each glyph's right in an rtl run as in an ltr one — where
108
+ * CoreText's kerning attribute and browsers put it — so a line that changes
109
+ * direction keeps one gap between every two neighbours: on the reading side
110
+ * of an rtl run's glyphs it came out twice where the direction changed one
111
+ * way and not at all where it changed back.
110
112
  */
111
113
  function spaceGlyphs(shaped, spacing) {
112
- const rtl = shaped.direction === 'rtl';
113
114
  let width = 0;
114
115
  for (const g of shaped.glyphs) {
115
- if (g.ax > 0) {
116
- g.ax += spacing;
117
- if (rtl) g.dx += spacing;
118
- }
116
+ if (g.ax > 0) g.ax += spacing;
119
117
  width += g.ax;
120
118
  }
121
119
  shaped.width = width;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ntk",
3
- "version": "8.12.9",
3
+ "version": "8.12.10",
4
4
  "description": "Desktop UI toolkit for X11 with canvas-like 2d and OpenGL rendering",
5
5
  "author": "Andrey Sidorov <sidorares@yandex.ru>",
6
6
  "license": "MIT",