tags:

views:

840

answers:

5

Note that this question continues from Is it possible to coax Visual Studio 2008 into using italics for comments?

If the long question title got you, here's the problem:

How to convert the style property of the Consolas Italic font to Bold without actually modifying any of its actual glyphs? That is, we want the font to be still the same (i.e., Italic) we merely want the OS to believe that it's now a Bold font.

Please just don't mention the name of a tool (Ex: fontforge), but describe the steps to achieve this or point to such a description.

+1  A: 

It looks like it cannot be done without some kind of tool. It's not really to do with windows, but with the ttf format. The style properties are built into the font file, and I don't think it's possible to tell windows to ignore them (if that's what you were asking for).

As for modifying the font, it looks like it's either FontForge or a hex-editor. I am looking into this one, and if/when I figure it out, I'll post instructions.

So far I've only managed to create a horribly broken version of Consolas :P

Blorgbeard
A: 

@Blorgbeard: I'm glad to hear that. I'm pretty sure that there are tons of folks using Visual Studio who would like to do this. I'm eager to get your detailed answer once you figure out how to achieve this.

Ashwin
+2  A: 

Alright, I've successfully used FontForge to create a copy of Consolas (although this should work with any font) with the bold style actually being italics.

These are the steps that I followed:

  • Install FontForge. It's a lot easier to do this on linux than on windows/cygwin. I used a Ubuntu VM ("sudo apt-get install fontforge").
  • Open Consola.ttf (the "normal" style font) in FontForge.
  • Select Element -> Font Info.
  • Change the Fontname, Family Name, and Name for Humans, all to the same thing. I used 'ConsolasVS'.
  • Click Ok. Click 'Yes' to let FontForge generate a new GUID for the font.
  • Select File -> Generate Fonts. Make sure you've got "TrueType" selected. Uncheck "Validate before saving". Click Save.
  • Now open Consolai.ttf (the italic style font) in FontForge.
  • Go back to Element -> Font Info.
  • Change the Font names as before, and where it currently says "Italic", change that to "Bold".
  • Go to the OS/2 tab, change the font weight to "700 Bold".
  • Go to the Mac tab, change the style set to Bold.
  • Click Ok. Allow a new GUID to be generated again.
  • File -> Generate Fonts, as before.

Copy your two new ttf files into your \Windows\FONTS\ folder.

You can now have nice italic comments with Consolas in VS2008. Hooray!

Blorgbeard
A: 

@Blorgbeard: I am able to generate the fake Bold font, but when I view the font or apply it, the text is missing some letters! I'm using Fontforge under Cygwin and seeing this behaviour.

Ashwin
+1  A: 

I did the italics-as-bold trick on Consolas back in July 2007 and posted a screenshot of it on my blog.

I used FontLab which does a great job but a custom tool to copy and set the header would be the best bet as you can't modify and redistribute Consolas and FontLab costs $699.

If you want to go down the FontLab route the open up the regular and italic versions and go into the File > Font Info... menu option and use the Names and Copyright section.

In there set them both fonts Family Name to a new name then flip the checkboxes on the italic version to indicate bold instead of italic and select Normal from the Weight list box and Italic in the Style Name list box.

Save and install :)

[)amien

DamienG