コード例 #1
0
ファイル: TerminalPanel.java プロジェクト: bitekas/jediterm
  protected void initFont() {
    myNormalFont = createFont();
    myBoldFont = myNormalFont.deriveFont(Font.BOLD);
    myItalicFont = myNormalFont.deriveFont(Font.ITALIC);
    myBoldItalicFont = myBoldFont.deriveFont(Font.ITALIC);

    establishFontMetrics();
  }
コード例 #2
0
ファイル: HyperSearchResults.java プロジェクト: SELab/jEdit
 // {{{ parseHighlightStyle()
 SyntaxStyle parseHighlightStyle(String style) {
   Font f = (resultTree != null) ? resultTree.getFont() : UIManager.getFont("Tree.font");
   SyntaxStyle s;
   try {
     s = SyntaxUtilities.parseStyle(style, f.getFamily(), f.getSize(), true, null);
   } catch (Exception e) {
     style = "color:#000000";
     s = SyntaxUtilities.parseStyle(style, f.getFamily(), f.getSize(), true);
   }
   return s;
 } // }}}
コード例 #3
0
ファイル: VCaretEntry.java プロジェクト: timburrow/OpenVnmrJ
 public void adjustFont(int w, int h) {
   if (h <= 0) return;
   int oldH = rHeight;
   if (font == null) {
     font = getFont();
     fontH = font.getSize();
     rHeight = fontH;
   }
   nHeight = h;
   if (fontH >= h) rHeight = h - 2;
   else rHeight = fontH;
   if ((rHeight < 10) && (fontH > 10)) rHeight = 10;
   if (oldH != rHeight) {
     // Font  curFont = font.deriveFont((float) rHeight);
     Font curFont = DisplayOptions.getFont(font.getName(), font.getStyle(), rHeight);
     setFont(curFont);
   }
   if (rHeight > h) rHeight = h;
 }
コード例 #4
0
ファイル: VCaretEntry.java プロジェクト: timburrow/OpenVnmrJ
 public void changeFont() {
   font = DisplayOptions.getFont(fontName, fontStyle, fontSize);
   setFont(font);
   fontH = font.getSize();
   rHeight = fontH;
   if (!inEditMode) {
     if ((curDim.height > 0) && (rHeight > curDim.height)) {
       adjustFont(curDim.width, curDim.height);
     }
   }
   repaint();
 }
コード例 #5
0
ファイル: TerminalPanel.java プロジェクト: bitekas/jediterm
  private void establishFontMetrics() {
    final BufferedImage img = createBufferedImage(1, 1);
    final Graphics2D graphics = img.createGraphics();
    graphics.setFont(myNormalFont);

    final float lineSpace = mySettingsProvider.getLineSpace();
    final FontMetrics fo = graphics.getFontMetrics();

    myDescent = fo.getDescent();
    myCharSize.width = fo.charWidth('W');
    myCharSize.height = fo.getHeight() + (int) (lineSpace * 2);
    myDescent += lineSpace;

    myMonospaced = isMonospaced(fo);
    if (!myMonospaced) {
      LOG.info("WARNING: Font " + myNormalFont.getName() + " is non-monospaced");
    }

    img.flush();
    graphics.dispose();
  }
コード例 #6
0
ファイル: VCaretEntry.java プロジェクト: timburrow/OpenVnmrJ
 public void setEditMode(boolean s) {
   if (s) {
     addMouseListener(ml);
     setOpaque(s);
     if (font != null) {
       setFont(font);
       fontH = font.getSize();
       rHeight = fontH;
     }
     defDim = getPreferredSize();
     curLoc.x = defLoc.x;
     curLoc.y = defLoc.y;
     curDim.width = defDim.width;
     curDim.height = defDim.height;
     xRatio = 1.0;
     yRatio = 1.0;
   } else {
     removeMouseListener(ml);
     if ((bg != null) || (isActive < 1)) setOpaque(true);
     else setOpaque(false);
   }
   inEditMode = s;
 }