Skip to content

Commit 37afd09

Browse files
committed
Change default RTF line spacing to 110%
1 parent dab9c7d commit 37afd09

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

.github/actions/bundle/dist/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -7011,6 +7011,11 @@ const getRTFNotes = (input) => {
70117011
* other win sizes are replaced below. The mac sizes are injected, as a JSON
70127012
* fragment, into the RTF comment field; utils.show_notes_dialog() can use
70137013
* this to perform replacements.
7014+
*
7015+
* We also add \sl264 \slmult1 to each paragraph to set line spacing
7016+
* to 110%. This works for both Mac and Win: 264 is 110% of 240, which
7017+
* is the default font size of 12pt in twips, and \slmult1 tells RTF to
7018+
* interpret this as a multiple of whatever font size is currently in use.
70147019
*/
70157020
const args = `
70167021
-f markdown
@@ -7029,7 +7034,7 @@ const getRTFNotes = (input) => {
70297034
case 'fs28': return 'fs20';
70307035
default: return match;
70317036
}
7032-
});
7037+
}).replace(/\\pard/g, '\\pard \\sl264 \\slmult1');
70337038
result = ` finaleplugin.RTFNotes = [[${result}]]`;
70347039
}
70357040
}

.github/actions/bundle/src/inject-extras.test.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function plugindef()
3838
\\widowctrl\\hyphauto
3939
\\fs18
4040
{\\info{\\comment "os":"mac","fs18":"fs24","fs26":"fs32","fs23":"fs29","fs20":"fs26"}}
41-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs26 Header 1\\par}
41+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs26 Header 1\\par}
4242
}
4343
]]
4444
finaleplugin.HashURL = "https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/test.hash"
@@ -92,7 +92,7 @@ function plugindef()
9292
\\widowctrl\\hyphauto
9393
\\fs18
9494
{\\info{\\comment "os":"mac","fs18":"fs24","fs26":"fs32","fs23":"fs29","fs20":"fs26"}}
95-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs26 Header 1\\par}
95+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs26 Header 1\\par}
9696
}
9797
]]
9898
finaleplugin.HashURL = "https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/test.hash"
@@ -172,7 +172,7 @@ function plugindef()
172172
\\widowctrl\\hyphauto
173173
\\fs18
174174
{\\info{\\comment "os":"mac","fs18":"fs24","fs26":"fs32","fs23":"fs29","fs20":"fs26"}}
175-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs26 Header 1\\par}
175+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs26 Header 1\\par}
176176
}
177177
]]
178178
finaleplugin.HashURL = "https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/test.hash"
@@ -221,7 +221,7 @@ function plugindef()
221221
\\widowctrl\\hyphauto
222222
\\fs18
223223
{\\info{\\comment "os":"mac","fs18":"fs24","fs26":"fs32","fs23":"fs29","fs20":"fs26"}}
224-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 This is a description of the plugin.\\par}
224+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 This is a description of the plugin.\\par}
225225
}
226226
]]
227227
finaleplugin.HashURL = "https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/test.hash"
@@ -315,18 +315,18 @@ function plugindef()
315315
\\widowctrl\\hyphauto
316316
\\fs18
317317
{\\info{\\comment "os":"mac","fs18":"fs24","fs26":"fs32","fs23":"fs29","fs20":"fs26"}}
318-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs26 Heading one\\par}
319-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs23 Heading two\\par}
320-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs20 Heading three\\par}
321-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 This is a regular paragraph with {\\b Bold} and {\\i Italic}.\\par}
322-
{\\pard \\ql \\f0 \\sa0 \\li360 \\fi-360 \\bullet \\tx360\\tab Bullet 1\\par}
323-
{\\pard \\ql \\f0 \\sa0 \\li360 \\fi-360 \\bullet \\tx360\\tab Bullet 2\\par}
324-
{\\pard \\ql \\f0 \\sa0 \\li360 \\fi-360 \\bullet \\tx360\\tab Bullet 3\\sa180\\par}
325-
{\\pard \\ql \\f0 \\sa0 \\li360 \\fi-360 1.\\tx360\\tab Number 1\\par}
326-
{\\pard \\ql \\f0 \\sa0 \\li360 \\fi-360 2.\\tx360\\tab Number 2\\par}
327-
{\\pard \\ql \\f0 \\sa0 \\li360 \\fi-360 3.\\tx360\\tab Number 3\\sa180\\par}
328-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 This is a paragraph with {\\f1 inline code}.\\par}
329-
{\\pard \\ql \\f0 \\sa180 \\li0 \\fi0 \\f1 function foo() \\{\\line
318+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs26 Heading one\\par}
319+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs23 Heading two\\par}
320+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 \\b \\fs20 Heading three\\par}
321+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 This is a regular paragraph with {\\b Bold} and {\\i Italic}.\\par}
322+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa0 \\li360 \\fi-360 \\bullet \\tx360\\tab Bullet 1\\par}
323+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa0 \\li360 \\fi-360 \\bullet \\tx360\\tab Bullet 2\\par}
324+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa0 \\li360 \\fi-360 \\bullet \\tx360\\tab Bullet 3\\sa180\\par}
325+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa0 \\li360 \\fi-360 1.\\tx360\\tab Number 1\\par}
326+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa0 \\li360 \\fi-360 2.\\tx360\\tab Number 2\\par}
327+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa0 \\li360 \\fi-360 3.\\tx360\\tab Number 3\\sa180\\par}
328+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 This is a paragraph with {\\f1 inline code}.\\par}
329+
{\\pard \\sl264 \\slmult1 \\ql \\f0 \\sa180 \\li0 \\fi0 \\f1 function foo() \\{\\line
330330
do_something()\\line
331331
\\}\\par}
332332
}

.github/actions/bundle/src/inject-extras.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ const getRTFNotes = (input: string): string => {
6060
* other win sizes are replaced below. The mac sizes are injected, as a JSON
6161
* fragment, into the RTF comment field; utils.show_notes_dialog() can use
6262
* this to perform replacements.
63+
*
64+
* We also add \sl264 \slmult1 to each paragraph to set line spacing
65+
* to 110%. This works for both Mac and Win: 264 is 110% of 240, which
66+
* is the default font size of 12pt in twips, and \slmult1 tells RTF to
67+
* interpret this as a multiple of whatever font size is currently in use.
6368
*/
6469
const args = `
6570
-f markdown
@@ -78,7 +83,8 @@ const getRTFNotes = (input: string): string => {
7883
case 'fs28': return 'fs20';
7984
default: return match;
8085
}
81-
})
86+
}).replace(/\\pard/g, '\\pard \\sl264 \\slmult1')
87+
8288
result = ` finaleplugin.RTFNotes = [[${result}]]`;
8389
}
8490
}

0 commit comments

Comments
 (0)