Applies To 
   
  Product(s): Bentley
  Version(s): N/A
  Environment:  N/A
  Area:  N/A
  Subarea:  N/A
  Original Author: Bentley Technical Support Group
   

 

 

 

 

 

 

 

 

Fonts in MicroStation

This is a collection of information related to fonts in MicroStation.

Why aren't my fonts available in the font picker?

Below are some common reasons why you may not see your fonts in the font pickers and/or see font substitution warning messages in the message center.

Hiding of Duplicate Font Names

Summary: RSC fonts hide SHX fonts, and both RSC and SHX fonts hide TrueType fonts (by-name).

What to do: Disable font hiding completely, or manually hide the undesired fonts so that the desired fonts are visible. See the 'Font Configuration File' section in the MicroStation help topic: ‘Composing Drawings' > ‘Annotations' > ‘Using Fonts'.

MicroStation V8i introduces the ability to hide fonts with duplicate names; this is the default behavior. This can occur if you have fonts of different types (RSC - MicroStation resource fonts, SHX - AutoCAD fonts, and TrueType fonts), but with the same name (e.g. "Arial").
RSC hides SHX because MicroStation can generate SHX fonts for the shear purpose of exporting to DWG; this means you will still generally want to use the appropriate RSC font, and ignore the SHX variants unless you need to work directly with the DWG file. SHX (and RSC) hide TrueType because over the years, many RSC and SHX fonts may have been converted to TrueType equivalents for various reasons. Preferring TrueType fonts could potentially prevent the use of many SHX and/or RSC fonts.

Font hiding can be disabled completely (find the HideDuplicateNames element in your configuration file, and change its value from ‘true' to ‘false'), or for specific fonts. See the MicroStation Font Configuration File Wiki page. Hiding specific fonts may be the best option as it preserves the intended behavior above, but allows the picking of the intended font in specific scenarios

As a side note, it may also be preferable to remove the offending lower level font(s). Fonts like "Arial" (normally TrueType) are sometimes hidden due to legacy RSC equivalents; TrueType fonts have many advantages, and the TrueType versions, when they exist, are recommended for use instead of RSC (or SHX) versions.

Font Definitions Are Not Found

Summary: MicroStation's message center says it is substituting fonts because they can't be found, or you believe that the font should be available but is not hidden as per above.

What to do: Ensure that the fonts are in places that MicroStation can find them; these locations can vary based on font type (see below). MS_FONTPATH can be used as a search path for all font types.

TrueType fonts: These are normally installed at the system level, and are found in your Windows fonts directory (%SYSTEMROOT%\Fonts, e.g. C:\Windows\Fonts). You must be an administrator on your computer to install TrueType fonts at this level. V8i also allows you to append search paths via the MS_FONTPATH configuration variable. V8i will also search the same directory as the design file if the font is not otherwise found (TrueType and SHX only).

RSC fonts: These fonts cannot be installed at the system level, and must be in a location found by configuration variables. RSC fonts are collected into RSC font libraries (*.RSC files), and are typically deployed with a workspace, or in the ‘system' directory of your local workspace. MicroStation will search all resource files in locations found via the following configuration variables: MS_SYMBRSRC and MS_FONTPATH. It builds a file list of first MS_SYMBRSRC, then of MS_FONTPATH. As it reads the RSC fonts, if there are font number conflicts, then the one added to the file list last wins. If there are multiple font libraries in the same directory, the order is alphabetical.

SHX fonts: These fonts cannot be installed at the system level, and must be in a location found by configuration variables or AutoCAD registry entries, or in the same directory as the DGN or DWG file in which it is referenced. MicroStation will search the AutoCAD font directory (as dictated by AutoCAD registry entries describing the most recently run version of AutoCAD), as well as all locations identified by the MS_FONTPATH and MS_DWGFONTPATH configuration variables.

API: What is a font number? (and why you'd rather not use them)

Most of the following information comes from the FontManager.h header file in the Public API, which also contains additional information.

Fonts are identified by their name and type. However, it would be inefficient to store a copy of the font name every time it is referenced inside a design file. For this reason MicroStation stores a "Font Table" in the non-model storage area of design files. The font table stores a mapping between a "Font Number" and a font name. So, for a given design file, all elements that refer to a given font number refer to the same font. However, it should be obvious that elements from a different design file may refer to same font through a different font number. Also, note that there is only one font table for the entire design file, so that all elements from all models use the same font table. To find a Font object from the font number in an element, the procedure is:

  1. Get the DgnFile that contains (or will contain) the element
  2. Get the FontNumMap from that DgnFile via one of the methods of FontManager
  3. Call either GetFont or ResolveFont on the FontNumMap to get a pointer to the Font

There is a convenience method on FontManager to return a FontNumMap from a DgnModelRef, since that is frequently the most convenient value from which to find a DgnFile. Note that this is merely a convenience method and it does not imply that there is a FontNumMap associated with DgnModelRef's. DgnModelRef's are associated with DgnFiles and DgnFiles have FontNumMaps. Therefore, all calls to GetFontMap through DgnModelRefs from the same DgnFile will return the same value.

There can be some confusion about font numbers related to legacy APIs. For example:

  • Font number ranges: Much of the existing MicroStation API encodes meaning to the values of font numbers. It implicitly defines that font numbers from 0-255 are RSC fonts, font numbers from 256-1023 are SHX fonts, and font numbers 1024 and above are TrueType fonts. One reason that these ranges are implied is that the Font Table only stores a mapping between font number and font name. It does not store the font type. Therefore, the font number implicitly specifies the font type. In retrospect, this association between font number and font type is a mistake and causes limitations and errors. In a future version of MicroStation, this limitation will be corrected and font numbers will NOT imply font type. Programmers should never, henceforth with the FontManager API, presume an association between font number and font name. The proper way to tell the font type for a font number is to get a Font object for the font, and query it directly.
  • RSC font numbers: RSC fonts existed before Font Tables were invented. So a given RSC font has the same font number across all files. [N.B. In fact, RSC fonts do not even appear in the Font Table. This is a severe limitation in that it is impossible to tell the name of the RSC font referenced in an element without the appropriate font library (.rsc), and the font will change unexpectedly if a different font library is present on the target computer from the originating one.] Therefore, lazy or uninformed programmers can pass "any" file to lookup an RSC and it will succeed. It is best to forget this fact and write code that works for all font types.

Common Font Number Questions

Q: Given a Font, how do I get its font number?
A: The question makes no sense. The same font may be referenced by many different font numbers from different design file. Now, if the question is "How can I determine if a Font exists in the Font Table for a design file, and if so, by what number?", then the answer is to get the FontNumMap for that file and call GetFontNumber.

Q: Given a font number, how do I get a Font?
A: The question makes no sense unless you qualify the font number with a DgnFile. In that case, get the FontNumMap for the file and call either GetFont or ResolveFont.

 

See Also

Product TechNotes and FAQs

External Links

Bentley Technical Support KnowledgeBase

Bentley LEARN Server

Comments or Corrections?

Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!