[]
当自定义图形逻辑需要测量或呈现文本时,使用此类可提供文本格式信息,例如字体系列、字体大小、粗体和斜体设置。它由 IGraphicsInfo.getDigitWidth(TextFormatInfo) 等 API 使用。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setFontFamily("Calibri");
textFormat.setFontSize(11);
textFormat.setBold(true);
textFormat.setItalic(false);
final booleangetBold()final Stringfinal doublefinal booleanfinal voidsetBold(boolean value) final voidsetFontFamily(String value) final voidsetFontSize(double value) final voidsetItalic(boolean value) 返回先前由 setFontFamily(String) 分配的系列名称。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setFontFamily("Calibri");
String fontFamily = textFormat.getFontFamily();
null。使用此方法可指定自定义图形逻辑在测量或呈现文本时应使用的系列名称。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setFontFamily("Calibri");
value - 字体系列名称;如果未设置字体系列,则为 null。返回先前由 setFontSize(double) 分配的字体大小。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setFontSize(11);
double fontSize = textFormat.getFontSize();
使用此方法可指定自定义图形逻辑在测量或呈现文本时应使用的字体大小,单位为磅。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setFontSize(11);
value - 所需字体大小,单位为磅。如果字体粗细为粗体 (700),则返回 true。否则,当字体粗细为正常或常规 (400) 时返回false。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setBold(true);
boolean bold = textFormat.getBold();
true;否则为 false。使用此方法可指定文本是否应使用粗体字体粗细。对于粗体文本设置为 true,对于正常文本设置为 false。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setBold(true);
value - 如果字体粗细为粗体 (700),则为 true;否则为 false。返回先前由 setItalic(boolean) 分配的斜体设置。如果此方法返回 true,则字体样式为斜体;否则,字体样式为正常。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setItalic(true);
boolean italic = textFormat.getItalic();
true;否则为 false。使用此方法可指定文本是否应使用斜体样式。
TextFormatInfo textFormat = new TextFormatInfo();
textFormat.setItalic(true);
value - 如果字体样式为斜体,则为 true;否则为 false。