當前位置: 首頁>>代碼示例>>Java>>正文


Java TextAttributes.getFontType方法代碼示例

本文整理匯總了Java中com.intellij.openapi.editor.markup.TextAttributes.getFontType方法的典型用法代碼示例。如果您正苦於以下問題:Java TextAttributes.getFontType方法的具體用法?Java TextAttributes.getFontType怎麽用?Java TextAttributes.getFontType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.editor.markup.TextAttributes的用法示例。


在下文中一共展示了TextAttributes.getFontType方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: reset

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@Override
public void reset(@NotNull TextAttributes ta) {
    myCbBold.setEnabled(true);
    myCbItalic.setEnabled(true);

    int fontType = ta.getFontType();
    myCbBold.setSelected(BitUtil.isSet(fontType, Font.BOLD));
    myCbItalic.setSelected(BitUtil.isSet(fontType, Font.ITALIC));

    resetColorChooser(myCbForeground, myForegroundChooser, ta.getForegroundColor());
    resetColorChooser(myCbBackground, myBackgroundChooser, ta.getBackgroundColor());
    resetColorChooser(myCbErrorStripe, myErrorStripeColorChooser, ta.getErrorStripeColor());

    Color effectColor = ta.getEffectColor();
    resetColorChooser(myCbEffects, myEffectsColorChooser, effectColor);

    if (effectColor == null) {
        myEffectsCombo.setEnabled(false);
    } else {
        myEffectsCombo.setEnabled(true);
        myEffectsModel.setSelectedItem(
                ContainerUtil.reverseMap(myEffectsMap).get(ta.getEffectType()));
    }
}
 
開發者ID:huoguangjin,項目名稱:MultiHighlight,代碼行數:25,代碼來源:ColorChooserPanel.java

示例2: equals

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private static boolean equals(TextAttributes attributes1, TextAttributes attributes2) {
  if (attributes2 == null) {
    return attributes1 == null;
  }
  if(attributes1 == null) {
    return false;
  }
  if(!Comparing.equal(attributes1.getForegroundColor(), attributes2.getForegroundColor())) {
    return false;
  }
  if(attributes1.getFontType() != attributes2.getFontType()) {
    return false;
  }
  if(!Comparing.equal(attributes1.getBackgroundColor(), attributes2.getBackgroundColor())) {
    return false;
  }
  if(!Comparing.equal(attributes1.getEffectColor(), attributes2.getEffectColor())) {
    return false;
  }
  return true;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:HTMLTextPainter.java

示例3: fromTextAttributes

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
@NotNull
public static SimpleTextAttributes fromTextAttributes(TextAttributes attributes) {
  if (attributes == null) return REGULAR_ATTRIBUTES;

  Color foregroundColor = attributes.getForegroundColor();
  if (foregroundColor == null) foregroundColor = REGULAR_ATTRIBUTES.getFgColor();

  int style = attributes.getFontType();
  if (attributes.getEffectColor() != null) {
    EffectType effectType = attributes.getEffectType();
    if (effectType == EffectType.STRIKEOUT) {
      style |= STYLE_STRIKEOUT;
    }
    else if (effectType == EffectType.WAVE_UNDERSCORE) {
      style |= STYLE_WAVED;
    }
    else if (effectType == EffectType.LINE_UNDERSCORE ||
             effectType == EffectType.BOLD_LINE_UNDERSCORE ||
             effectType == EffectType.BOLD_DOTTED_LINE) {
      style |= STYLE_UNDERLINE;
    }
    else if (effectType == EffectType.SEARCH_MATCH) {
      style |= STYLE_SEARCH_MATCH;
    }
    else {
      // not supported
    }
  }
  return new SimpleTextAttributes(attributes.getBackgroundColor(), foregroundColor, attributes.getEffectColor(), style);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:31,代碼來源:SimpleTextAttributes.java

示例4: LineExtensionInfo

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
public LineExtensionInfo(@NotNull String text, @NotNull TextAttributes attr) {
  myText = text;
  myColor = attr.getForegroundColor();
  myEffectType = attr.getEffectType();
  myEffectColor = attr.getEffectColor();
  myFontType = attr.getFontType();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:LineExtensionInfo.java

示例5: setPrefix

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
public void setPrefix(String prefixText, TextAttributes attributes) {
  assertIsDispatchThread();
  myPrefixText = prefixText;
  synchronized (myLock) {
    myPrefixLayout = prefixText == null || prefixText.isEmpty() ? null :
                     new LineLayout(this, prefixText, attributes.getFontType());
  }
  myPrefixAttributes = attributes;
  mySizeManager.invalidateRange(0, 0);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:EditorView.java

示例6: getFoldRegionLayout

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
LineLayout getFoldRegionLayout(FoldRegion foldRegion) {
  LineLayout layout = foldRegion.getUserData(FOLD_REGION_TEXT_LAYOUT);
  if (layout == null) {
    TextAttributes placeholderAttributes = myEditor.getFoldingModel().getPlaceholderAttributes();
    layout = new LineLayout(this, foldRegion.getPlaceholderText(), 
                            placeholderAttributes == null ? Font.PLAIN : placeholderAttributes.getFontType());
    foldRegion.putUserData(FOLD_REGION_TEXT_LAYOUT, layout);
  }
  return layout;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:EditorView.java

示例7: advance

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
public void advance() {
  if (mySegmentIterator.atEnd()) {
    myRangeIterator.advance();
    TextAttributes textAttributes = myRangeIterator.getTextAttributes();
    myCurrentFontStyle = textAttributes == null ? Font.PLAIN : textAttributes.getFontType();
    myCurrentForegroundColor = textAttributes == null ? null : textAttributes.getForegroundColor();
    myCurrentBackgroundColor = textAttributes == null ? null : textAttributes.getBackgroundColor();
    mySegmentIterator.reset(myRangeIterator.getRangeStart(), myRangeIterator.getRangeEnd(), myCurrentFontStyle);
  }
  mySegmentIterator.advance();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:TextWithMarkupProcessor.java

示例8: NamedTextAttr

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
public NamedTextAttr(@NotNull String name, @NotNull TextAttributes ta) {
    super(ta.getForegroundColor(), ta.getBackgroundColor(), ta.getEffectColor(),
            ta.getEffectType(), ta.getFontType());
    setErrorStripeColor(ta.getErrorStripeColor());
    this.name = name;
}
 
開發者ID:huoguangjin,項目名稱:MultiHighlight,代碼行數:7,代碼來源:NamedTextAttr.java

示例9: paintImmediately

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private void paintImmediately(Graphics g, int offset, char c, boolean insert) {
  if (g == null) return; // editor component is currently not displayable

  TextAttributes attributes = ((LexerEditorHighlighter)getHighlighter()).getAttributes((DocumentImpl)getDocument(), offset, c);

  int fontType = attributes.getFontType();
  FontInfo fontInfo = EditorUtil.fontForChar(c, attributes.getFontType(), myEditor);
  Font font = fontInfo.getFont();

  // it's more reliable to query actual font metrics
  FontMetrics fontMetrics = myEditor.getFontMetrics(fontType);

  int charWidth = fontMetrics.charWidth(c);

  int delta = charWidth;

  if (!insert && offset < getDocument().getTextLength()) {
    delta -= fontMetrics.charWidth(getDocument().getCharsSequence().charAt(offset));
  }

  Rectangle tailArea = lineRectangleBetween(offset, getDocument().getLineEndOffset(myEditor.offsetToLogicalLine(offset)));
  if (tailArea.isEmpty()) {
    tailArea.width += EditorUtil.getSpaceWidth(fontType, myEditor); // include caret
  }

  Color background = attributes.getBackgroundColor() == null ? getCaretRowBackground() : attributes.getBackgroundColor();

  Rectangle newArea = lineRectangleBetween(offset, offset);
  newArea.width += charWidth;

  String newText = Character.toString(c);
  Point point = newArea.getLocation();
  int ascent = myEditor.getAscent();
  Color foreground = attributes.getForegroundColor() == null ? myEditor.getForegroundColor() : attributes.getForegroundColor();

  EditorUIUtil.setupAntialiasing(g);

  // pre-compute all the arguments beforehand to minimize delays between the calls (as there's no double-buffering)
  if (delta != 0) {
    shift(g, tailArea, delta);
  }
  fill(g, newArea, background);
  print(g, newText, point, ascent, font, foreground);

  // flush changes (there can be batching / buffering in video driver)
  Toolkit.getDefaultToolkit().sync();

  if (isZeroLatencyTypingDebugEnabled()) {
    pause();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:52,代碼來源:ImmediatePainter.java

示例10: doRecalculateSoftWraps

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private void doRecalculateSoftWraps(IncrementalCacheUpdateEvent event) {
  myEventBeingProcessed = event;
  notifyListenersOnCacheUpdateStart(event);
  // Preparation.
  myContext.reset();
  myOffset2fontType.clear();
  myOffset2widthInPixels.clear();

  // Define start of the visual line that holds target range start.
  final int start = event.getStartOffset(); 
  final LogicalPosition logical = event.getStartLogicalPosition();

  Document document = myEditor.getDocument();
  myContext.text = document.getCharsSequence();
  myContext.tokenStartOffset = start;
  IterationState iterationState = new IterationState(myEditor, start, document.getTextLength(), false);
  TextAttributes attributes = iterationState.getMergedAttributes();
  myContext.fontType = attributes.getFontType();
  myContext.rangeEndOffset = event.getMandatoryEndOffset();

  EditorPosition position = myEditor.myUseNewRendering ? new EditorPosition(logical, event.getStartVisualPosition(), start, myEditor) : 
                            new EditorPosition(logical, start, myEditor);
  position.x = start == 0 ? myEditor.getPrefixTextWidthInPixels() : 0;
  int spaceWidth = EditorUtil.getSpaceWidth(myContext.fontType, myEditor);
  int plainSpaceWidth = EditorUtil.getSpaceWidth(Font.PLAIN, myEditor);

  myContext.logicalLineData.update(logical.line, spaceWidth, plainSpaceWidth);

  myContext.currentPosition = position;
  myContext.lineStartPosition = position.clone();
  myContext.fontType2spaceWidth.put(myContext.fontType, spaceWidth);
  myContext.softWrapStartOffset = position.offset;

  myContext.reservedWidthInPixels = myPainter.getMinDrawingWidth(SoftWrapDrawingType.BEFORE_SOFT_WRAP_LINE_FEED);
  
  SoftWrap softWrapAtStartPosition = myStorage.getSoftWrap(start);
  if (softWrapAtStartPosition != null) {
    myContext.currentPosition.x = softWrapAtStartPosition.getIndentInPixels();
    myContext.lineStartPosition.visualColumn = 0;
    myContext.lineStartPosition.softWrapColumnDiff -= softWrapAtStartPosition.getIndentInColumns();
    myContext.softWrapStartOffset++;
    
    notifyListenersOnVisualLineStart(myContext.lineStartPosition);
  }

  // Perform soft wraps calculation.
  while (!iterationState.atEnd()) {
    FoldRegion currentFold = iterationState.getCurrentFold();
    if (currentFold == null) {
      myContext.tokenEndOffset = iterationState.getEndOffset();
      if (processNonFoldToken()) {
        break;
      }
    }
    else {
      if (processCollapsedFoldRegion(currentFold)) {
        break;
      }

      // 'myOffset2widthInPixels' contains information necessary to processing soft wraps that lay before the current offset.
      // We do know that soft wraps are not allowed to go backward after processed collapsed fold region, hence, we drop
      // information about processed symbols width.
      myOffset2widthInPixels.clear();
    }

    iterationState.advance();
    attributes = iterationState.getMergedAttributes();
    myContext.fontType = attributes.getFontType();
    myContext.tokenStartOffset = iterationState.getStartOffset();
    myOffset2fontType.fill(myContext.tokenStartOffset, iterationState.getEndOffset(), myContext.fontType);
  }
  if (myContext.delayedSoftWrap != null) {
    myStorage.remove(myContext.delayedSoftWrap);
  }
  notifyListenersOnVisualLineEnd();
  event.setActualEndOffset(myContext.currentPosition.offset);
  validateFinalPosition(event);
  notifyListenersOnCacheUpdateEnd(event);
  myEventBeingProcessed = null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:81,代碼來源:SoftWrapApplianceManager.java

示例11: findNextSuitableRange

import com.intellij.openapi.editor.markup.TextAttributes; //導入方法依賴的package包/類
private void findNextSuitableRange() {
  myNextAttributes = null;
  while(myIterator.hasNext()) {
    RangeHighlighterEx highlighter = myIterator.next();
    if (highlighter == null || !highlighter.isValid() || !isInterestedInLayer(highlighter.getLayer())) {
      continue;
    }
    // LINES_IN_RANGE highlighters are not supported currently
    myNextStart = Math.max(highlighter.getStartOffset(), myStartOffset);
    myNextEnd = Math.min(highlighter.getEndOffset(), myEndOffset);
    if (myNextStart >= myEndOffset) {
      break;
    }
    if (myNextStart < myCurrentEnd) {
      continue; // overlapping ranges withing document markup model are not supported currently
    }
    TextAttributes attributes = null;
    Object tooltip = highlighter.getErrorStripeTooltip();
    if (tooltip instanceof HighlightInfo) {
      HighlightInfo info = (HighlightInfo)tooltip;
      TextAttributesKey key = info.forcedTextAttributesKey;
      if (key == null) {
        HighlightInfoType type = info.type;
        key = type.getAttributesKey();
      }
      if (key != null) {
        attributes = myColorsScheme.getAttributes(key);
      }
    }
    if (attributes == null) {
      continue;
    }
    Color foreground = attributes.getForegroundColor();
    Color background = attributes.getBackgroundColor();
    if ((foreground == null || myDefaultForeground.equals(foreground))
        && (background == null || myDefaultBackground.equals(background))
        && attributes.getFontType() == Font.PLAIN) {
      continue;
    }
    myNextAttributes = attributes;
    break;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:44,代碼來源:TextWithMarkupProcessor.java


注:本文中的com.intellij.openapi.editor.markup.TextAttributes.getFontType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。