0

Trying to set a font size below 8 in Eclipse 3.7 I stubled upon a line in

.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.workbench.prefs


This is the line:
org.eclipse.jface.textfont=1|Envy Code R|7.75|0|WINDOWS|1|-11|0|0|0|400|0|0|0|0|3|2|1|49|Envy Code R;

Someone knows what the various pieces (devided by a |) mean?

LppEdd
  • 20,274
  • 11
  • 84
  • 139

2 Answers2

1

The value is the string returned by the toString() method of FontData. This value is platform specific, you will have to inspect the FontData source code for your platform to determine exactly what it means.

The org.eclipse.jface.preference.PreferenceConverter class provides various methods for converting FontData to/from this string.

greg-449
  • 109,219
  • 232
  • 102
  • 145
1

Thanks to Greg input, this is how the string is formed. The first part seems to be platform independant.

1      |Envy Code R|7.75  |0
version|name       |height|style

The rest is platform dependant.

WINDOWS |1       |-11     |0      |0           |0            |400     |0       |0          |0          |0        |3             |2              |1        |49             
platform|version2|lfHeight|lfWidth|lfEscapement|lfOrientation|lfWeight|lfItalic|lfUnderline|lfStrikeOut|lfCharSet|lfOutPrecision|lfClipPrecision|lfQuality|lfPitchAndFamily

And in Windows is represented by the Class

public abstract class LOGFONT {
    public int lfHeight;
    public int lfWidth;
    public int lfEscapement;
    public int lfOrientation;
    public int lfWeight;
    public byte lfItalic;
    public byte lfUnderline;
    public byte lfStrikeOut;
    public byte lfCharSet;
    public byte lfOutPrecision;
    public byte lfClipPrecision;
    public byte lfQuality;
    public byte lfPitchAndFamily;
    public static final int sizeof = OS.IsUnicode ? OS.LOGFONTW_sizeof () : OS.LOGFONTA_sizeof ();
}

which is obviously a "copy" of the C struct:

typedef struct tagLOGFONT {
  LONG  lfHeight;
  LONG  lfWidth;
  LONG  lfEscapement;
  LONG  lfOrientation;
  LONG  lfWeight;
  BYTE  lfItalic;
  BYTE  lfUnderline;
  BYTE  lfStrikeOut;
  BYTE  lfCharSet;
  BYTE  lfOutPrecision;
  BYTE  lfClipPrecision;
  BYTE  lfQuality;
  BYTE  lfPitchAndFamily;
  TCHAR lfFaceName[LF_FACESIZE];
} LOGFONT, *PLOGFONT;
LppEdd
  • 20,274
  • 11
  • 84
  • 139