本文整理汇总了Java中org.intellij.lang.annotations.JdkConstants.FontStyle方法的典型用法代码示例。如果您正苦于以下问题:Java JdkConstants.FontStyle方法的具体用法?Java JdkConstants.FontStyle怎么用?Java JdkConstants.FontStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.intellij.lang.annotations.JdkConstants
的用法示例。
在下文中一共展示了JdkConstants.FontStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawCharsCached
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
private void drawCharsCached(@NotNull Graphics g,
CharSequence data,
int start,
int end,
int x,
int y,
@JdkConstants.FontStyle int fontType,
Color color,
boolean drawWhitespace) {
FontInfo fnt = EditorUtil.fontForChar(data.charAt(start), fontType, this);
if (myLastCache != null && spacesOnly(data, start, end) && fnt.charWidth(' ') == myLastCache.spaceWidth) {
// we don't care about font if we only need to paint spaces and space width matches
myLastCache.addContent(g, data, start, end, x, y, null, drawWhitespace);
}
else {
drawCharsCached(g, data, start, end, x, y, fnt, color, drawWhitespace);
}
}
示例2: charToVisibleWidth
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
/**
* Allows to answer how much width requires given char to be represented on a screen.
*
* @param c target character
* @param fontType font type to use for representation of the given character
* @param currentX current <code>'x'</code> position on a line where given character should be displayed
* @return width required to represent given char with the given settings on a screen;
* <code>'0'</code> if given char is a line break
*/
private int charToVisibleWidth(char c, @JdkConstants.FontStyle int fontType, int currentX) {
if (c == '\n') {
return 0;
}
if (c == '\t') {
return EditorUtil.nextTabStop(currentX, this) - currentX;
}
return EditorUtil.charWidth(c, fontType, this);
}
示例3: paintSelectionOnSecondSoftWrapLineIfNecessary
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
/**
* End user is allowed to perform selection by visual coordinates (e.g. by dragging mouse with left button hold). There is a possible
* case that such a move intersects with soft wrap introduced virtual space. We want to draw corresponding selection background
* there then.
* <p/>
* This method encapsulates functionality of drawing selection background on the second soft wrap line (e.g. on a visual line after
* the one where it is applied).
*
* @param g graphics to draw on
* @param position current position (assumed to be position of soft wrap appliance)
* @param clip target drawing area boundaries
* @param defaultBackground default background
* @param fontType current font type
* @param softWrap target soft wrap which second line virtual space may contain selection
*/
private void paintSelectionOnSecondSoftWrapLineIfNecessary(@NotNull Graphics g,
@NotNull Point position,
@NotNull Rectangle clip,
@NotNull Color defaultBackground,
@JdkConstants.FontStyle int fontType,
@NotNull SoftWrap softWrap) {
// There is a possible case that the user performed selection at soft wrap virtual space. We need to paint corresponding background
// there then.
VisualPosition selectionStartPosition = getSelectionStartPositionForPaint();
VisualPosition selectionEndPosition = getSelectionEndPositionForPaint();
if (selectionStartPosition.equals(selectionEndPosition)) {
return;
}
int currentVisualLine = position.y / getLineHeight();
// Check if the second soft wrap line is within the visual selection.
if (currentVisualLine < selectionStartPosition.line || currentVisualLine > selectionEndPosition.line
|| currentVisualLine == selectionStartPosition.line && selectionStartPosition.column >= softWrap.getIndentInColumns()) {
return;
}
// Adjust 'x' if selection starts at soft wrap virtual space.
if (selectionStartPosition.line == currentVisualLine && selectionStartPosition.column > 0) {
position.x += selectionStartPosition.column * EditorUtil.getSpaceWidth(fontType, this);
}
// Calculate selection width.
final int width;
if (selectionEndPosition.line > currentVisualLine || selectionEndPosition.column >= softWrap.getIndentInColumns()) {
width = softWrap.getIndentInPixels() - position.x;
}
else {
width = selectionEndPosition.column * EditorUtil.getSpaceWidth(fontType, this) - position.x;
}
drawBackground(g, getColorsScheme().getColor(EditorColors.SELECTION_BACKGROUND_COLOR), width, position, defaultBackground, clip);
}
示例4: getFontAbleToDisplay
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
@NotNull
public static FontInfo getFontAbleToDisplay(char c, int size, @JdkConstants.FontStyle int style, @NotNull String defaultFontFamily) {
FontInfo result = doGetFontAbleToDisplay(c, size, style, defaultFontFamily);
if (result != null) {
return result;
}
return doGetFontAbleToDisplay(c, size, style);
}
示例5: drawStringWithSoftWraps
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
private int drawStringWithSoftWraps(@NotNull Graphics g,
@NotNull final String text,
@NotNull Point position,
@NotNull Rectangle clip,
Color effectColor,
EffectType effectType,
@JdkConstants.FontStyle int fontType,
Color fontColor,
int startDrawingOffset,
WhitespacePaintingStrategy context) {
return drawStringWithSoftWraps(g, text, 0, text.length(), position, clip, effectColor, effectType,
fontType, fontColor, startDrawingOffset, context);
}
示例6: charWidth
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
public int charWidth(char c, @JdkConstants.FontStyle int fontType) {
int key = c + fontType * (Character.MAX_VALUE + 1);
int width = myCache.get(key);
if (width < 0) {
myCache.put(key, width = EditorUtil.charWidth(c, fontType, myEditor));
}
return width;
}
示例7: charToVisibleWidth
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
/**
* Allows to answer how much width requires given char to be represented on a screen.
*
* @param c target character
* @param fontType font type to use for representation of the given character
* @param currentX current <code>'x'</code> position on a line where given character should be displayed
* @return width required to represent given char with the given settings on a screen;
* <code>'0'</code> if given char is a line break
*/
private int charToVisibleWidth(char c, @JdkConstants.FontStyle int fontType, int currentX) {
if (c == '\n') {
return 0;
}
if (c == '\t') {
return EditorUtil.nextTabStop(currentX, this) - currentX;
}
return EditorUtil.charWidth(c, fontType, this);
}
示例8: AttributesFlyweight
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
private AttributesFlyweight(Color foreground,
Color background,
@JdkConstants.FontStyle int fontType,
Color effectColor,
EffectType effectType,
Color errorStripeColor) {
myForeground = foreground;
myBackground = background;
myFontType = fontType;
myEffectColor = effectColor;
myEffectType = effectType;
myErrorStripeColor = errorStripeColor;
myHashCode = calcHashCode(foreground, background, fontType, effectColor, effectType, errorStripeColor);
}
示例9: setFontType
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
public void setFontType(@JdkConstants.FontStyle int type) {
if (type < 0 || type > 3) {
LOG.error("Wrong font type: " + type);
type = 0;
}
myAttrs = myAttrs.withFontType(type);
}
示例10: paintSelectionOnFirstSoftWrapLineIfNecessary
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
/**
* End user is allowed to perform selection by visual coordinates (e.g. by dragging mouse with left button hold). There is a possible
* case that such a move intersects with soft wrap introduced virtual space. We want to draw corresponding selection background
* there then.
* <p/>
* This method encapsulates functionality of drawing selection background on the first soft wrap line (e.g. on a visual line where
* it is applied).
*
* @param g graphics to draw on
* @param position current position (assumed to be position of soft wrap appliance)
* @param clip target drawing area boundaries
* @param defaultBackground default background
* @param fontType current font type
*/
private void paintSelectionOnFirstSoftWrapLineIfNecessary(@NotNull Graphics g,
@NotNull Point position,
@NotNull Rectangle clip,
@NotNull Color defaultBackground,
@JdkConstants.FontStyle int fontType) {
// There is a possible case that the user performed selection at soft wrap virtual space. We need to paint corresponding background
// there then.
VisualPosition selectionStartPosition = getSelectionStartPositionForPaint();
VisualPosition selectionEndPosition = getSelectionEndPositionForPaint();
if (selectionStartPosition.equals(selectionEndPosition)) {
return;
}
int currentVisualLine = position.y / getLineHeight();
int lastColumn = EditorUtil.getLastVisualLineColumnNumber(this, currentVisualLine);
// Check if the first soft wrap line is within the visual selection.
if (currentVisualLine < selectionStartPosition.line || currentVisualLine > selectionEndPosition.line
|| currentVisualLine == selectionEndPosition.line && selectionEndPosition.column <= lastColumn) {
return;
}
// Adjust 'x' if selection starts at soft wrap virtual space.
final int columnsToSkip = selectionStartPosition.column - lastColumn;
if (columnsToSkip > 0) {
position.x += getSoftWrapModel().getMinDrawingWidthInPixels(SoftWrapDrawingType.BEFORE_SOFT_WRAP_LINE_FEED);
position.x += (columnsToSkip - 1) * EditorUtil.getSpaceWidth(Font.PLAIN, this);
}
// Calculate selection width.
final int width;
if (selectionEndPosition.line > currentVisualLine) {
width = clip.x + clip.width - position.x;
}
else if (selectionStartPosition.line < currentVisualLine || selectionStartPosition.column <= lastColumn) {
width = getSoftWrapModel().getMinDrawingWidthInPixels(SoftWrapDrawingType.BEFORE_SOFT_WRAP_LINE_FEED)
+ (selectionEndPosition.column - lastColumn - 1) * EditorUtil.getSpaceWidth(fontType, this);
}
else {
width = (selectionEndPosition.column - selectionStartPosition.column) * EditorUtil.getSpaceWidth(fontType, this);
}
drawBackground(g, getColorsScheme().getColor(EditorColors.SELECTION_BACKGROUND_COLOR), width, position, defaultBackground, clip);
}
示例11: drawTabbedString
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
private int drawTabbedString(@NotNull Graphics g,
CharSequence text,
int start,
int end,
int x,
int y,
@Nullable Color effectColor,
EffectType effectType,
@JdkConstants.FontStyle int fontType,
Color fontColor,
@NotNull final Rectangle clip,
WhitespacePaintingStrategy context) {
int xStart = x;
for (int i = start; i < end; i++) {
if (text.charAt(i) != '\t') continue;
x = drawTablessString(text, start, i, g, x, y, fontType, fontColor, clip, context);
int x1 = EditorUtil.nextTabStop(x, this);
drawTabPlacer(g, y, x, x1, i, context);
x = x1;
start = i + 1;
}
x = drawTablessString(text, start, end, g, x, y, fontType, fontColor, clip, context);
if (effectColor != null) {
final Color savedColor = g.getColor();
// myBorderEffect.flushIfCantProlong(g, this, effectType, effectColor);
int xEnd = x;
if (xStart < clip.x && xEnd < clip.x || xStart > clip.x + clip.width && xEnd > clip.x + clip.width) {
return x;
}
if (xEnd > clip.x + clip.width) {
xEnd = clip.x + clip.width;
}
if (xStart < clip.x) {
xStart = clip.x;
}
if (effectType == EffectType.LINE_UNDERSCORE) {
g.setColor(effectColor);
UIUtil.drawLine(g, xStart, y + 1, xEnd, y + 1);
g.setColor(savedColor);
}
else if (effectType == EffectType.BOLD_LINE_UNDERSCORE) {
g.setColor(effectColor);
drawBoldLineUnderScore(g, xStart, y, xEnd-xStart);
g.setColor(savedColor);
}
else if (effectType == EffectType.STRIKEOUT) {
g.setColor(effectColor);
int y1 = y - getCharHeight() / 2;
UIUtil.drawLine(g, xStart, y1, xEnd, y1);
g.setColor(savedColor);
}
else if (effectType == EffectType.WAVE_UNDERSCORE) {
g.setColor(effectColor);
UIUtil.drawWave((Graphics2D)g, new Rectangle(xStart, y+1, xEnd - xStart, getDescent() - 1));
g.setColor(savedColor);
}
else if (effectType == EffectType.BOLD_DOTTED_LINE) {
final Color bgColor = getBackgroundColor();
final int dottedAt = SystemInfo.isMac ? y : y + 1;
UIUtil.drawBoldDottedLine((Graphics2D)g, xStart, xEnd, dottedAt, bgColor, effectColor, false);
}
}
return x;
}
示例12: FontKey
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
public FontKey(@NotNull String familyName, final int size, @JdkConstants.FontStyle int style) {
myFamilyName = familyName;
mySize = size;
myStyle = style;
}
示例13: FontInfo
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
public FontInfo(final String familyName, final int size, @JdkConstants.FontStyle int style) {
mySize = size;
myStyle = style;
Font font = new Font(familyName, style, size);
myFont = ENABLE_OPTIONAL_LIGATURES ? getFontWithLigaturesEnabled(font) : font;
}
示例14: getFontType
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
@JdkConstants.FontStyle
public int getFontType() {
return myFontType;
}
示例15: getStyle
import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
@JdkConstants.FontStyle
public int getStyle() {
return myStyle;
}