format.set_FormatFlags( StringFormatFlags.wrap( StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap |
StringFormatFlags.FitBlackBox ));
format.set_Trimming( StringTrimming.wrap( StringTrimming.None ) );
format.SetMeasurableCharacterRanges(new CharacterRange[] {new CharacterRange(0, 1)});
Graphics g = createGraphics( frc );
Region[] regions = g.MeasureCharacterRanges(String.valueOf((char)cp), font.getNetFont(),
new RectangleF(0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE), format);
SizeF size = regions[0].GetBounds(g).get_Size();
regions[0].Dispose();
return frc.usesFractionalMetrics() ? size.get_Width() : Math.round(size.get_Width());
}