congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Font.getDevice
Code IndexAdd Tabnine to your IDE (free)

How to use
getDevice
method
in
org.eclipse.swt.graphics.Font

Best Java code snippets using org.eclipse.swt.graphics.Font.getDevice (Showing top 20 results out of 315)

origin: org.eclipse.platform/org.eclipse.jface

@Override
public Font createFont(Device device) {
  // If this descriptor is an existing font, then we can return the original font
  // if this is the same device.
  if (originalFont != null) {
    // If we're allocating on the same device as the original font, return the original.
    if (originalFont.getDevice() == device) {
      return originalFont;
    }
  }
  return new Font(device, data);
}
origin: org.eclipse.rap/org.eclipse.rap.jface

public Font createFont(Device device) {
  
  // If this descriptor is an existing font, then we can return the original font
  // if this is the same device.
  if (originalFont != null) {         
    // If we're allocating on the same device as the original font, return the original.
    if (originalFont.getDevice() == device) {
      return originalFont;
    }
  }
  
  return new Font(device, data);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

@Override
public Font createFont(Device device) {
  // If this descriptor is an existing font, then we can return the original font
  // if this is the same device.
  if (originalFont != null) {
    // If we're allocating on the same device as the original font, return the original.
    if (originalFont.getDevice() == device) {
      return originalFont;
    }
  }
  return new Font(device, data);
}
origin: org.eclipse.platform/org.eclipse.ui.workbench.texteditor

Font getScaledFont(Font editorFont) {
  if (editorFont == null) {
    return null;
  }
  Font scaledFont = fScaledFonts.get(editorFont);
  if (scaledFont != null) {
    return scaledFont;
  }
  FontData[] fontData = editorFont.getFontData();
  FontData fontDatum = fontData[0];
  scaledFont = new Font(editorFont.getDevice(), fontDatum.getName(),
      (int) Math.ceil(fontDatum.getHeight() * getScale()), fontDatum.getStyle());
  fScaledFonts.put(editorFont, scaledFont);
  return scaledFont;
}
origin: BiglySoftware/BiglyBT

private Font createBoldFont(Font original) {
  FontData[] font_data = original.getFontData();
  for (int i=0; i<font_data.length; i++) {
    font_data[i].setStyle(font_data[i].getStyle() | SWT.BOLD);
  }
  return new Font(original.getDevice(), font_data);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text

/**
 * Creates (if not already done) and returns the bold font used by the styler to apply the bold
 * style.
 * 
 * <p>
 * <strong>Note:</strong> The callers must not cache and re-use the returned font outside the
 * current call.
 * </p>
 * 
 * @return the bold font used by the styler
 */
public Font getBoldFont() {
  if (fBoldFont == null) {
    FontData[] data= fFont.getFontData();
    for (int i= 0; i < data.length; i++) {
      data[i].setStyle(SWT.BOLD);
    }
    fBoldFont= new Font(fFont.getDevice(), data);
  }
  return fBoldFont;
}
origin: org.eclipse.xtext/ui

public PixelConverter(Font font) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  fFontMetrics = gc.getFontMetrics();
  gc.dispose();
}
origin: BiglySoftware/BiglyBT

public static int getFontHeightInPX(Font font) {
  GC gc = new GC(font.getDevice());
  try {
    gc.setFont(font);
    return gc.textExtent(Utils.GOOD_STRING).y;
  } finally {
    gc.dispose();
  }
}
origin: BiglySoftware/BiglyBT

public static Font getFontPercentOf(Font baseFont, float pct) {
  FontData[] fontData = baseFont.getFontData();
  float height = getHeight(fontData) * pct;
  setFontDataHeight(fontData, height);
  return new Font(baseFont.getDevice(), fontData);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

public PixelConverter(Font font) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  fFontMetrics= gc.getFontMetrics();
  gc.dispose();
}
origin: org.eclipse.platform/org.eclipse.jface

/**
 * Create a PixelConverter which will convert device-independent units to
 * pixels using the specified font.
 *
 * @param font
 *            the font that should be used for pixel conversions.
 */
public PixelConverter(Font font) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  fontMetrics = gc.getFontMetrics();
  gc.dispose();
}
origin: org.eclipse/org.eclipse.jdt.ui

public PixelConverter(Font font) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  fFontMetrics= gc.getFontMetrics();
  gc.dispose();
}

origin: org.eclipse.rap/org.eclipse.rap.jface

/**
 * Create a PixelConverter which will convert device-independent units to
 * pixels using the specified font.
 * 
 * @param font
 *            the font that should be used for pixel conversions.
 */
public PixelConverter(Font font) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  fontMetrics = gc.getFontMetrics();
  gc.dispose();
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

public PixelConverter(Font font) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  fFontMetrics= gc.getFontMetrics();
  gc.dispose();
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * Create a PixelConverter which will convert device-independent units to
 * pixels using the specified font.
 *
 * @param font
 *            the font that should be used for pixel conversions.
 */
public PixelConverter(Font font) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  fontMetrics = gc.getFontMetrics();
  gc.dispose();
}
origin: org.eclipse.pde/org.eclipse.pde.api.tools.ui

public int convertWidthInCharsToPixels(Font font, int chars) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  FontMetrics fontMetrics = gc.getFontMetrics();
  gc.dispose();
  return Dialog.convertWidthInCharsToPixels(fontMetrics, chars);
}
origin: BiglySoftware/BiglyBT

public static Font getFontWithStyle(Font baseFont, int style,
    float sizeByPct) {
  FontData[] fontData = baseFont.getFontData();
  for (FontData fd : fontData) {
    fd.setStyle(style);
  }
  if (sizeByPct != 1.0f) {
    float height = getHeight(fontData) * sizeByPct;
    setFontDataHeight(fontData, height);
  }
  return new Font(baseFont.getDevice(), fontData);
}
origin: org.eclipse.pde.api.tools/ui

public int convertWidthInCharsToPixels(Font font, int chars) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  FontMetrics fontMetrics= gc.getFontMetrics();
  gc.dispose();
  return Dialog.convertWidthInCharsToPixels(fontMetrics, chars);
}
origin: BiglySoftware/BiglyBT

  private static Font ensureFontFitsHeight(Font font, int pxMaxHeight) {
    int px = getFontHeightInPX(font);
    if (px <= pxMaxHeight) {
      //System.out.println("ensureFontFitsHeight; wanted max " + pxMaxHeight + "; got " + px);
      return font;
    }
    Device device = font.getDevice();
    FontData[] fontData = font.getFontData();
    float height = getHeight(fontData);
    int newPX;
    do {
      height -= 0.25;
      setFontDataHeight(fontData, height);
      font = new Font(device, fontData);

      newPX = getFontHeightInPX(font);
      //System.out.println("Reduced font; wanted max " + pxMaxHeight + "; got " + px + "; trying " + height + " adjusts to " + newPX);
    } while (newPX > pxMaxHeight);

    return font;
  }
}
origin: org.apache.uima/uimaj-ep-cas-editor

/**
 * Sets the text size.
 *
 * @param newSize the new text size
 */
private void setTextSize(int newSize) {
 Font font = getSourceViewer().getTextWidget().getFont();
 
 if (font.getFontData().length > 0) {
  FontData fd = font.getFontData()[0];
  getSourceViewer().getTextWidget().setFont(new Font(font.getDevice(),
      fd.getName(), newSize, fd.getStyle()));
 }
}
 
org.eclipse.swt.graphicsFontgetDevice

Popular methods of Font

  • getFontData
    Returns an array of FontDatas representing the receiver. On Windows, only one FontData will be retur
  • <init>
  • dispose
  • isDisposed
    Returns true if the font has been disposed, and false otherwise. This method gets the dispose state
  • equals
    Compares the argument to the receiver, and returns true if they represent the same object using a c
  • hashCode
    Returns an integer hash code for the receiver. Any two objects that return true when passed toequal
  • init
  • gtk_new
    Invokes platform specific functionality to allocate a new font.IMPORTANT: This method is not part of
  • addTraits
  • checkDevice
  • cocoa_new
    Invokes platform specific functionality to allocate a new font.IMPORTANT: This method is not part of
  • findFontData
  • cocoa_new,
  • findFontData,
  • win32_new

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • getApplicationContext (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Socket (java.net)
    Provides a client-side TCP socket.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JCheckBox (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now