|How to change relative font size with a macro
|Page 1 of 1|
|Author:||marshman [ 2007-08-07 06:43:12 ]|
|Post subject:||How to change relative font size with a macro|
I have trying Nisus Writer Pro and I would like to create a macro that switch from English typographic rules to the French ones. For example, I would like to find all instances of "!" in an text and add a non-breaking space before it AND change the size of this space to be half of the one use for the "!". Is it possible to do such things? If so, could someone give me some clues on how to do it.
|Author:||martin [ 2007-08-07 12:38:13 ]|
Unfortunately there's no way to inspect the current font size of text in a document, so you will not be able to change the size of the non-breaking space based on the following punctuation. However, if you can decide on fixed font size in advance then this macro should do:
You could also ask the user what font size they want to use at the start of the macro. One caveat: you are limited to the predefined font sizes that appear on the menu.
Also, another way to accomplish the same thing much more efficiently:
This code makes use of the attribute sensitive replacement option 'U' so you will need to make sure that only attributes you desire are applied to the macro document. One way to do that is to use the menu Remove Attributes and Styles on the macro and then apply the font size you want to the non-breaking space.
|Author:||Kino [ 2008-10-03 09:14:19 ]|
I have written a NW Classic macro for a similar purpose for a French journalist. Oh, it was my very first macro posted to the Dartmouth list — near the end of the last century. Nostalgy... ;-)
According to a book I received from him as a cadeau, it would be convenient to shorten no-break spaces not only before "!" but also before ";" and "?". However, this rule is not always observed, it seems. That's a problem of personal taste, after all. Anyway, to get something close to "quart de cadratin insécable" (shorter no-break space), I think it would be convenient to apply Subscript (or Superscript) style on those no-break spaces. Then, the relative font size will be kept even if you change the font size.
In the Nisus Writer Pro Macro language, the macro (with some revisions) would be...
If you want to shorten no-break space before "!" only, change the Find All command to
|Page 1 of 1||All times are UTC - 8 hours|
|Powered by phpBB® Forum Software © phpBB Group