@@ -267,19 +267,31 @@ function fontRuns(value: string): FontRun[] {
267267 }
268268 } )
269269
270- for ( const [ index , character ] of characters . entries ( ) ) {
271- if ( character . family !== 'Geist' || ! character . neutral ) continue
272-
273- let previous = index - 1
274- while ( previous >= 0 && characters [ previous ] . neutral ) previous -= 1
275- let next = index + 1
276- while ( next < characters . length && characters [ next ] . neutral ) next += 1
277- const previousFamily = characters [ previous ] ?. family
278- const nextFamily = characters [ next ] ?. family
279- if ( previousFamily && previousFamily !== 'Geist' && previousFamily === nextFamily ) {
280- character . family = previousFamily
281- } else if ( previousFamily && previousFamily !== 'Geist' && next >= characters . length ) {
282- character . family = previousFamily
270+ let index = 0
271+ while ( index < characters . length ) {
272+ if ( ! characters [ index ] . neutral ) {
273+ index += 1
274+ continue
275+ }
276+
277+ const start = index
278+ while ( index < characters . length && characters [ index ] . neutral ) index += 1
279+
280+ const previousFamily = characters [ start - 1 ] ?. family
281+ const nextFamily = characters [ index ] ?. family
282+ const inheritedFamily =
283+ previousFamily &&
284+ previousFamily !== 'Geist' &&
285+ ( previousFamily === nextFamily || index === characters . length )
286+ ? previousFamily
287+ : undefined
288+
289+ if ( inheritedFamily ) {
290+ for ( let neutralIndex = start ; neutralIndex < index ; neutralIndex += 1 ) {
291+ if ( characters [ neutralIndex ] . family === 'Geist' ) {
292+ characters [ neutralIndex ] . family = inheritedFamily
293+ }
294+ }
283295 }
284296 }
285297
@@ -489,6 +501,10 @@ function estimateTableRowHeight(row: JSONContent, columnCount: number): number {
489501function chunkTableRows ( header : JSONContent , rows : JSONContent [ ] ) : TableChunk [ ] {
490502 const columnCount = header . content ?. length ?? rows [ 0 ] ?. content ?. length ?? 1
491503 const headerHeight = estimateTableRowHeight ( header , columnCount )
504+ if ( rows . length === 0 ) {
505+ return [ { rows : [ ] , unbreakable : headerHeight <= MAX_UNBREAKABLE_TABLE_HEIGHT } ]
506+ }
507+
492508 const chunks : TableChunk [ ] = [ ]
493509 let current : JSONContent [ ] = [ ]
494510 let currentHeight = headerHeight
0 commit comments