0

Specifically, I want to modify two fonts so that the metrics for the space character (ASCII 32) in one font match the metrics of the other font.

Linux or Mac open source solutions preferred.

3

You don't need to edit an actual font or add multiple spaces to achieve indents, and in fact doing so would cause many undesirable problems. Anyone else on a different computer viewing/editing your document would not see the changes unless they installed the version of the font you altered. Also all spaces would be altered, not just the ones being used to indent the text. There are also legal considerations, such as the fact that most font licences do not allow modifying of font files or redistribution of those font files.

It's much easier to create indents using the software you are using to type/layout the document.

You can set indents using page layout software such as Scribus (open source Mac/Linux/Windows), or even word processing software such as LibreOffice Text (also open source).

This is for Scribus:

  1. Type some lines of text in a text box
  2. Change the fonts to whatever you want, set the point size as desired
  3. Highlight the text you wish to indent, to select it
  4. On the ruler above, click and drag the indent marker to the desired position

Example

enter image description here

Note: If for some (unknown) reason you must use spaces to achieve the indents, it's also possible to select the spaces and set them all to a particular font, even when the following text is in a different font.

Also, although I wouldn't recommend altering font files to achieve your desired indents, you would need font creation software to do it. FontForge is Open Source software which allows you to create or edit fonts. Note that it's highly complex software with a steep learning curve.

  • Thanks for this in-depth answer. I've updated my question to add a bit of context, mainly revolving around the fact that I'm pulling in some text from external source code files. I'll give fontforge a go! – Mark Harrison Oct 6 at 0:16
  • @MarkHarrison just as long as you know I don't recommend editing font files to achieve your desired results, for the reasons I already stated. – Billy Kerr Oct 6 at 0:52
  • 1
    Acknowledging that, although I've published three computer books over the years (two for O'Reilly and one for Addison Wesley), and it's a standard practice for included source code. You can see that as well on Stack Exchange where 4-space leading indentation indicates a code block. But regardless, fiddling with FontForge produced the desired results, and I'm now able to swap between the two font families as desired without changing the meaning of the code, allowing me to hit the pedagogical goals of the formatting. FontForge is supported by Brew on Mac, so it was easy to install as well. – Mark Harrison Oct 6 at 5:57
  • 2
    @MarkHarrison Yes i understand how code works. But i also understand how a typesetting engine works. There is nothing that stops a good software to automatically convert number of spaces to indentations. Both InDesign and Scribus as well as tex is capable of doing this, this invalidates need to change font. – joojaa Oct 6 at 18:33
  • 2
    I think joojaa is saying that you are asking for help with the wrong solution: meta.stackexchange.com/questions/66377/what-is-the-xy-problem – Yorik Oct 16 at 15:46
0

Applications like Illustrator and InDesign have a Tabs option in Paragraph Styles. Otherwise a program like "Glyphs" on the Apple store you could adjust things like that.

0

FontForge is an open source program that allows (among many other things) the user to edit the metrics for a particular character.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.