Repository: yamatoiizuka/palt-typesetting (ts)
Issue: Make thin spaces around middle dots half-width
中点類（・：；）の前後は四分アキではなく、八分アキにする。
四分アキだとだいぶ空いて見えてしまう。

`calc(options.thinSpaceWidth / 2.0)` みたいにすれば OK。
Pull request description: Make thin spaces around middle dots half-width
Fix #214 

Patch:
diff --git a/src/insert-separators.ts b/src/insert-separators.ts
index a2ea897..1698e42 100644
--- a/src/insert-separators.ts
+++ b/src/insert-separators.ts
@@ -2,7 +2,7 @@ import LineBreaker from 'linebreak'
 import { CharClass, LanguageClass } from './util-text-classes.js'
 import { createWbr, createThinSpace } from './util-tags.js'
 import { TypesettingOptions } from '../types'
-import { whitespaceRegex } from './util-regex.js'
+import { middleDotsRegex, whitespaceRegex } from './util-regex.js'
 
 /**
  * HTMLテキストノードにセパレーター（四分アキ、<wbr>）を挿入します。
@@ -46,7 +46,9 @@ const addSeparatorsToSegment = (current: string, next = '', options: Typesetting
   const breakable = isBreakable(current, next)
 
   if (addThinSpace) {
-    const thinSpaceWidth = options.thinSpaceWidth ?? ''
+    // セグメントの片方が中点類の場合、四分アキの幅を 1/2 にする
+    const hasMiddleDots = middleDotsRegex.test(current) || middleDotsRegex.test(next)
+    const thinSpaceWidth = hasMiddleDots ? `calc(${options.thinSpaceWidth} / 2.0)` : options.thinSpaceWidth ?? ''
     return current + createThinSpace(thinSpaceWidth, breakable)
   }
 


Test patch:
diff --git a/tests/index.test.ts b/tests/index.test.ts
index c9a464e..2324a5c 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -8,10 +8,14 @@ describe('Typesetter', () => {
   const options = Typesetter.getDefaultOptions()
   const spaceWidth = options.thinSpaceWidth
   const space = createThinSpace(spaceWidth, true)
-  const nbsp = createThinSpace(spaceWidth, false)
+
+  const halfSpaceWidth = `calc(${spaceWidth} / 2.0)`
+  const halfSpace  = createThinSpace(halfSpaceWidth, true)
+  const halfNbsp  = createThinSpace(halfSpaceWidth, false)
+
   const srcHtml = `<p>──<b>こんにちは。</b>「日本語」とEnglish、晴れ・28度。</p>`
 
-  const expectedHtml = `<p>${applyWrapperStyle(`${applyNoBreaksStyle('──')}${space}`, true)}<b>${applyWrapperStyle(`こんにちは。${space}`, true)}</b>${applyWrapperStyle(`「日本語」${space}と${space}${applyLatinStyle('English')}、${space}晴れ${nbsp}・${space}${applyLatinStyle('28')}${space}度。`, true)}</p>`
+  const expectedHtml = `<p>${applyWrapperStyle(`${applyNoBreaksStyle('──')}${space}`, true)}<b>${applyWrapperStyle(`こんにちは。${space}`, true)}</b>${applyWrapperStyle(`「日本語」${space}と${space}${applyLatinStyle('English')}、${space}晴れ${halfNbsp}・${halfSpace}${applyLatinStyle('28')}${space}度。`, true)}</p>`
 
   const typeset = new Typesetter()
 
diff --git a/tests/insert-separators.test.ts b/tests/insert-separators.test.ts
index 7483070..4e8d3be 100644
--- a/tests/insert-separators.test.ts
+++ b/tests/insert-separators.test.ts
@@ -13,11 +13,15 @@ const wbr = createWbr()
 const space = createThinSpace(options.thinSpaceWidth, true)
 const nbsp = createThinSpace(options.thinSpaceWidth, false)
 
+const halfSpaceWidth = `calc(${options.thinSpaceWidth} / 2.0)`
+const halfSpace = createThinSpace(halfSpaceWidth, true)
+const halfNbsp = createThinSpace(halfSpaceWidth, false)
+
 describe('insertSeparators', () => {
   it('inserts separators (thin spaces, <wbr>) into HTML text nodes', () => {
     const currentText = '──「こんにちは。」日本語とEnglish、晴れ・28度à vous。'
     const nextText = '「合成フォント」の見本。'
-    const expected = `──${nbsp}「こんにちは。」${space}日本語${wbr}と${space}English、${space}晴れ${nbsp}・${space}28${space}度${space}à ${wbr}vous。${space}`
+    const expected = `──${nbsp}「こんにちは。」${space}日本語${wbr}と${space}English、${space}晴れ${halfNbsp}・${halfSpace}28${space}度${space}à ${wbr}vous。${space}`
     expect(insertSeparatorsToText(currentText, nextText, options)).toEqual(expected)
   })
 
@@ -177,12 +181,12 @@ describe('addSeparatorsToSegment', () => {
     {
       current: '晴れ',
       next: '・',
-      expected: '晴れ' + nbsp,
+      expected: '晴れ' + halfNbsp,
     },
     {
       current: '・',
       next: '28',
-      expected: '・' + space,
+      expected: '・' + halfSpace,
     },
     {
       current: '28',
@@ -274,12 +278,12 @@ describe('addSeparatorsToSegment without useWordBreak', () => {
     {
       current: '晴れ',
       next: '・',
-      expected: '晴れ' + nbsp,
+      expected: '晴れ' + halfNbsp,
     },
     {
       current: '・',
       next: '28',
-      expected: '・' + space,
+      expected: '・' + halfSpace,
     },
     {
       current: '28',