当前位置: 首页>>代码示例>>Java>>正文


Java JdkConstants.FontStyle方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:EditorImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:bigFile.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:54,代码来源:EditorImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ComplementaryFontsRegistry.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:bigFile.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CharWidthCache.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:bigFile.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AttributesFlyweight.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:TextAttributes.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:59,代码来源:bigFile.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:74,代码来源:bigFile.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ComplementaryFontsRegistry.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:FontInfo.java

示例14: getFontType

import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
@JdkConstants.FontStyle
public int getFontType() {
  return myFontType;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LineExtensionInfo.java

示例15: getStyle

import org.intellij.lang.annotations.JdkConstants; //导入方法依赖的package包/类
@JdkConstants.FontStyle
public int getStyle() {
  return myStyle;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:FontInfo.java


注:本文中的org.intellij.lang.annotations.JdkConstants.FontStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。