Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(mcp-host): keep a narrow no-break space from breaking a PDF line

marcoteb04802318c08b
diff --git a/mcp-host/src/workflow/__tests__/fonts.test.ts b/mcp-host/src/workflow/__tests__/fonts.test.ts
index 535b0d974..91b27af01 100644
--- a/mcp-host/src/workflow/__tests__/fonts.test.ts
+++ b/mcp-host/src/workflow/__tests__/fonts.test.ts
@@ -79,6 +79,14 @@ describe('glyph coverage', () => {
})
})
+describe('asciiStandIn', () => {
+ it('keeps the spaces that do not break a line from breaking one', () => {
+ expect(asciiStandIn('\u202F')).toBe('\u00A0')
+ expect(asciiStandIn('\u2007')).toBe('\u00A0')
+ expect(asciiStandIn('\u2009')).toBe(' ')
+ })
+})
+
describe('sanitizeForFont', () => {
it('leaves pure ASCII untouched', () => {
const text = 'Revenue grew 12% in Q3 (USD 1,200).'
diff --git a/mcp-host/src/workflow/fonts.ts b/mcp-host/src/workflow/fonts.ts
index a4088f1f8..67e748edd 100644
--- a/mcp-host/src/workflow/fonts.ts
+++ b/mcp-host/src/workflow/fonts.ts
@@ -1067,11 +1067,13 @@ const SUBSTITUTIONS: Record<string, string> = {
'\u2004': ' ',
'\u2005': ' ',
'\u2006': ' ',
- '\u2007': ' ',
+ // A figure space and a narrow no-break space keep a number or a time such as
+ // '8:11 PM' on one line, so they stand in as a no-break space.
+ '\u2007': '\u00A0',
'\u2008': ' ',
'\u2009': ' ',
'\u200A': ' ',
- '\u202F': ' ',
+ '\u202F': '\u00A0',
'\u205F': ' ',
'\u3000': ' ',
// Status emoji, which models often put alone in a table cell. No embedded