Vented font

edited November 2013 in KLayout Development
Would you consider changing the default font for text so that it is vented (no enclosed area within letters)? I'll upload a sample of what I mean.


  • edited November -1
    (Actually I guess I can't upload a file, so I will email it to Matthias so he can post it if he wants to.)
  • edited November -1
    P.S. I replaced the default font with a vented version and recompiled fairly easily under Linux, but I wasn't able to get compiling under windows to work--I can use the Linux version OK, but others want to stick to windows. I'm hoping that other users may prefer a vented font also.
  • edited November -1


    you don't nee to recompile the tool. You can actually install fonts by packing them into a normal layout file and putting that to some particular place. You'll have to observe some rules (i.e. layer numbers) and you can add some meta information to enhance the font information.

    For more information see "Klayout's path" is the search path where KLayout looks for it's data. On Linux this will be "~/.klayout", so you'll have to put your font to "~/.klayout/fonts". You can also install a font globally if you put the file to folder called "font" into the installation path - that is where klayout's executable is stored.


  • edited November -1
    Excellent--thanks for your help and for this great layout software.
  • edited November -1
    Hi Matthias,

    I got an additional question related to the font stuff.
    I have drawn a new font an implemented under ~Program\Klayout\fonts\my_font.gds

    This was successful and I can select within editor. I also want to use within a ruby script but how can I set the font with ruby?

    Thanks for your help an much more thanks for that nice tool

  • edited September 2015

    (Sorry, I keep answering for Matthias, but I hope it's helpful rather than annoying)

    First you need the font index. Place a BASIC.Text Pcell and look at its properties. There is a "Font" dropdown. First entry is 0, second is 1, etc. If yours is second then you use 1.

    Now we need to use that number. Insert a PCell following the example here. But, instead of this line

    param = { "text" => "KLAYOUT RULES", "layer" => RBA::LayerInfo::new(10, 0), "mag" => 2.5 }

    you'd add the font index

    param = { "text" => "KLAYOUT RULES", "layer" => RBA::LayerInfo::new(10, 0), "mag" => 2.5, "font" => 1 }

    Note, you don't have to specify anything that has a default. Everything but 'text' and 'layer' have defaults, so you could remove 'mag' (which defaults to 1.0, which you can tell if you query its default -- let me know if you want details about how to do that) and just have

    param = { "text" => "KLAYOUT RULES", "layer" => RBA::LayerInfo::new(10, 0), "font" => 1 }

    Though, I have never tried since I have no custom fonts installed on my system, it should work.


  • edited November -1

    Hi David,

    no worries - I really appreciate your contributions! :-)

    But did I really chose the font index for the parameter? I'm a bit scared now since what will happen if someone installs a third font which inserts itself between 0 and 1?

    I'll have to check this ... a name would have been a better choice for the parameter value.

    Thanks for mentioning this.


  • edited November -1


    I'm afraid the font is really just an index ... I see some issues when a new font is added to the system. In that case, it's not guaranteed that the font will be added to the end and the indexes will shift.

    So what I am going to do is to add a new parameter which carries the font name. If the font name is present, the PCell will pick the font by name. Otherwise it will pick the font by index. That is backward compatible and provides some safety against change of font index.

    Thanks for bringing this up.


  • In case anyone else, like me, was hoping to find instructions on how to use a "vented" font:

    Vented font usage:

    • Here is one example of a vented font - I just cut holes in the default "std_font.gds" from github:
    • Place this file in the following directory: $HOME/.klayout/fonts (make the 'fonts' directory). On Windows this would be something like C:\Users\YourUserName.klayout, on MacOS it is /Users/YourUserName/.klayout (Use Finder's Go>Go To Folder... and type ~/.klayout ).
    • Restart
    • In your design, use the Text tool to type some text.
    • Select that text, then choose Edit>Selection>Convert to PCell... and edit the properties on the resulting PCell Instance. in the dropdown for "Font" you should see "Vented std_font".

    I don't see how to make this "default" though - the built-in "std_font.gds" might actually be compiled somewhere, I don't see it in the sub-folders. If it is just a file somewhere, you could either delete it, or replace it with this one. However, anytime you upgrade "std_font.gds" will likely be replaced.

  • @Matthias I noticed that, when installing this vented font, KLayout had a notice saying "use a vector font" - have you seen, or have an example of a vector font that I can edit?

  • I think that is something different - that refers to text objects (labels), not text PCells. Vector fonts are scalable and change their size when zooming.

    When does not message appear?


  • I see - so it doesn't help with converting to PCell (Polygons) which is what I want - thanks for clarifying.
    Sorry having trouble remembering where I saw that warning - will let you know when I find it again.

Sign In or Register to comment.