Skip to content

Commit c26f605

Browse files
authored
Merge pull request #3895 from Tyriar/3894
Make corner box chars more round
2 parents 0525f43 + 4cbfd86 commit c26f605

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/browser/renderer/CustomGlyphs.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,17 @@ const enum Style {
179179
BOLD = 3
180180
}
181181

182+
/**
183+
* @param xp The percentage of 15% of the x axis.
184+
* @param yp The percentage of 15% of the x axis on the y axis.
185+
*/
186+
type DrawFunctionDefinition = (xp: number, yp: number) => string;
187+
182188
/**
183189
* This contains the definitions of all box drawing characters in the format of SVG paths (ie. the
184190
* svg d attribute).
185191
*/
186-
export const boxDrawingDefinitions: { [character: string]: { [fontWeight: number]: string | ((xp: number, yp: number) => string) } | undefined } = {
192+
export const boxDrawingDefinitions: { [character: string]: { [fontWeight: number]: string | DrawFunctionDefinition } | undefined } = {
187193
// Uniform normal and bold
188194
'─': { [Style.NORMAL]: Shapes.LEFT_TO_RIGHT },
189195
'━': { [Style.BOLD]: Shapes.LEFT_TO_RIGHT },
@@ -319,10 +325,10 @@ export const boxDrawingDefinitions: { [character: string]: { [fontWeight: number
319325
'┋': { [Style.BOLD]: Shapes.FOUR_DASHES_VERTICAL },
320326

321327
// Curved
322-
'╭': { [Style.NORMAL]: 'C.5,1,.5,.5,1,.5' },
323-
'╮': { [Style.NORMAL]: 'C.5,1,.5,.5,0,.5' },
324-
'╯': { [Style.NORMAL]: 'C.5,0,.5,.5,0,.5' },
325-
'╰': { [Style.NORMAL]: 'C.5,0,.5,.5,1,.5' }
328+
'╭': { [Style.NORMAL]: (xp, yp) => `M.5,1 L.5,${.5 + (yp / .15 * .5)} C.5,${.5 + (yp / .15 * .5)},.5,.5,1,.5` },
329+
'╮': { [Style.NORMAL]: (xp, yp) => `M.5,1 L.5,${.5 + (yp / .15 * .5)} C.5,${.5 + (yp / .15 * .5)},.5,.5,0,.5` },
330+
'╯': { [Style.NORMAL]: (xp, yp) => `M.5,0 L.5,${.5 - (yp / .15 * .5)} C.5,${.5 - (yp / .15 * .5)},.5,.5,0,.5` },
331+
'╰': { [Style.NORMAL]: (xp, yp) => `M.5,0 L.5,${.5 - (yp / .15 * .5)} C.5,${.5 - (yp / .15 * .5)},.5,.5,1,.5` }
326332
};
327333

328334
interface IVectorShape {

0 commit comments

Comments
 (0)