File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,9 +129,11 @@ describe("FontManager delete owners", () => {
129129} ) ;
130130
131131describe ( "FontManager preview face" , ( ) => {
132- it ( "draws a cached font's name in the face the cache registered" , ( ) => {
132+ it ( "draws a sample beside a cached font's name in the face the cache registered, and the name in the UI face " , ( ) => {
133133 const r = render ( < FontManager /> ) ;
134- expect ( r . getByTitle ( "E:ARIAL.TTF" ) . style . fontFamily ) . toMatch ( / ^ " z p l - / ) ;
134+ const name = r . getByTitle ( "E:ARIAL.TTF" ) ;
135+ expect ( name . style . fontFamily ) . toBe ( "" ) ;
136+ expect ( ( name . nextElementSibling as HTMLElement ) . style . fontFamily ) . toMatch ( / ^ " z p l - / ) ;
135137 } ) ;
136138
137139 it ( "names a font no browser face took, and leaves its row unstyled" , async ( ) => {
@@ -151,7 +153,7 @@ describe("FontManager preview face", () => {
151153 }
152154 const r = render ( < FontManager /> ) ;
153155 expect ( r . getByText ( / c a n n o t r e n d e r t h i s f o n t / ) ) . toBeTruthy ( ) ;
154- expect ( r . getByTitle ( "E:BROKEN.TTF" ) . style . fontFamily ) . toBe ( "" ) ;
156+ expect ( r . getByTitle ( "E:BROKEN.TTF" ) . nextElementSibling ) . toBeNull ( ) ;
155157 } ) ;
156158} ) ;
157159
Original file line number Diff line number Diff line change @@ -274,12 +274,16 @@ function FontEntry({
274274 return (
275275 < div className = "flex flex-col gap-0.5 px-2 py-1.5 rounded border border-transparent hover:border-border-2 hover:bg-surface-2 transition-colors" >
276276 < div className = "grid grid-cols-[1fr_3rem_auto] items-center gap-2" >
277- < span
278- className = "font-mono text-xs text-text truncate"
279- style = { cachedFontFaceStyle ( previewFamily ) }
280- title = { name }
281- >
282- { name }
277+ < span className = "flex items-center gap-2 min-w-0" >
278+ < span className = "font-mono text-xs text-text truncate" title = { name } >
279+ { name }
280+ </ span >
281+ { /* The face shows on a sample, not on the name, so a display font leaves the name readable. */ }
282+ { previewFamily && (
283+ < span className = "text-sm leading-none text-muted shrink-0" style = { cachedFontFaceStyle ( previewFamily ) } aria-hidden = "true" >
284+ Aa
285+ </ span >
286+ ) }
283287 </ span >
284288 < Tooltip
285289 className = "w-full"
You can’t perform that action at this time.
0 commit comments