org.eclipse.swt.graphics.Device.getScreenDPI()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.eclipse.swt.graphics.Device.getScreenDPI()方法的一些代码示例,展示了Device.getScreenDPI()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Device.getScreenDPI()方法的具体详情如下:
包路径:org.eclipse.swt.graphics.Device
类名称:Device
方法名:getScreenDPI

Device.getScreenDPI介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

/**
 * Returns a point whose x coordinate is the horizontal
 * dots per inch of the display, and whose y coordinate
 * is the vertical dots per inch of the display.
 *
 * @return the horizontal and vertical DPI
 *
 * @exception SWTException <ul>
 *    <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
 * </ul>
 */
public Point getDPI () {
  checkDevice ();
  return getScreenDPI();
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

/**
 * Returns a point whose x coordinate is the horizontal
 * dots per inch of the display, and whose y coordinate
 * is the vertical dots per inch of the display.
 *
 * @return the horizontal and vertical DPI
 *
 * @exception SWTException <ul>
 *    <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
 * </ul>
 */
public Point getDPI () {
  checkDevice ();
  return getScreenDPI();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

/**
 * Returns a point whose x coordinate is the horizontal
 * dots per inch of the display, and whose y coordinate
 * is the vertical dots per inch of the display.
 *
 * @return the horizontal and vertical DPI
 *
 * @exception SWTException <ul>
 *    <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
 * </ul>
 */
public Point getDPI () {
  checkDevice ();
  return getScreenDPI();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

/**
 * Returns a point whose x coordinate is the horizontal
 * dots per inch of the display, and whose y coordinate
 * is the vertical dots per inch of the display.
 *
 * @return the horizontal and vertical DPI
 *
 * @exception SWTException <ul>
 *    <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
 * </ul>
 */
public Point getDPI () {
  checkDevice ();
  return getScreenDPI();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

String name = new String(Converter.mbcsToWcs(null, buffer));
float height = (float)OS.pango_font_description_get_size(handle) / OS.PANGO_SCALE;
Point dpi = device.dpi, screenDPI = device.getScreenDPI();
float size = height * screenDPI.y / dpi.y;
int pangoStyle = OS.pango_font_description_get_style(handle);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

String name = new String(Converter.mbcsToWcs(null, buffer));
float height = (float)OS.pango_font_description_get_size(handle) / OS.PANGO_SCALE;
Point dpi = device.dpi, screenDPI = device.getScreenDPI();
float size = height * screenDPI.y / dpi.y;
int pangoStyle = OS.pango_font_description_get_style(handle);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

String name = new String(Converter.mbcsToWcs(null, buffer));
float height = (float)OS.pango_font_description_get_size(handle) / OS.PANGO_SCALE;
Point dpi = device.dpi, screenDPI = device.getScreenDPI();
float size = height * screenDPI.y / dpi.y;
int pangoStyle = OS.pango_font_description_get_style(handle);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

void init(String name, float height, int style, byte[] fontString) {
  if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  Point dpi = device.dpi, screenDPI = device.getScreenDPI();
  float size = height * dpi.y / screenDPI.y;
  if (fontString != null) {
    handle = OS.pango_font_description_from_string (fontString);
    if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
  } else {
    handle = OS.pango_font_description_new();
    if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
    byte[] buffer = Converter.wcsToMbcs(null, name, true);
    OS.pango_font_description_set_family(handle, buffer);
    if (size > 0) {
      OS.pango_font_description_set_size(handle, (int)(0.5f + size * OS.PANGO_SCALE));
    }
    OS.pango_font_description_set_stretch(handle, OS.PANGO_STRETCH_NORMAL);
    int pangoStyle = OS.PANGO_STYLE_NORMAL;
    int pangoWeight = OS.PANGO_WEIGHT_NORMAL;
    if ((style & SWT.ITALIC) != 0) pangoStyle = OS.PANGO_STYLE_ITALIC;
    if ((style & SWT.ROMAN) != 0) pangoStyle = OS.PANGO_STYLE_OBLIQUE;
    if ((style & SWT.BOLD) != 0) pangoWeight = OS.PANGO_WEIGHT_BOLD;
    OS.pango_font_description_set_style(handle, pangoStyle);
    OS.pango_font_description_set_weight(handle, pangoWeight);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

void init(String name, float height, int style, byte[] fontString) {
  if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  Point dpi = device.dpi, screenDPI = device.getScreenDPI();
  float size = height * dpi.y / screenDPI.y;
  if (fontString != null) {
    handle = OS.pango_font_description_from_string (fontString);
    if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
  } else {
    handle = OS.pango_font_description_new();
    if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
    byte[] buffer = Converter.wcsToMbcs(null, name, true);
    OS.pango_font_description_set_family(handle, buffer);
    if (size > 0) {
      OS.pango_font_description_set_size(handle, (int)(0.5f + size * OS.PANGO_SCALE));
    }
    OS.pango_font_description_set_stretch(handle, OS.PANGO_STRETCH_NORMAL);
    int pangoStyle = OS.PANGO_STYLE_NORMAL;
    int pangoWeight = OS.PANGO_WEIGHT_NORMAL;
    if ((style & SWT.ITALIC) != 0) pangoStyle = OS.PANGO_STYLE_ITALIC;
    if ((style & SWT.ROMAN) != 0) pangoStyle = OS.PANGO_STYLE_OBLIQUE;
    if ((style & SWT.BOLD) != 0) pangoWeight = OS.PANGO_WEIGHT_BOLD;
    OS.pango_font_description_set_style(handle, pangoStyle);
    OS.pango_font_description_set_weight(handle, pangoWeight);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void init(String name, float height, int style, byte[] fontString) {
  if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  Point dpi = device.dpi, screenDPI = device.getScreenDPI();
  float size = height * dpi.y / screenDPI.y;
  if (fontString != null) {
    handle = OS.pango_font_description_from_string (fontString);
    if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
  } else {
    handle = OS.pango_font_description_new();
    if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
    byte[] buffer = Converter.wcsToMbcs(null, name, true);
    OS.pango_font_description_set_family(handle, buffer);
    if (size > 0) {
      OS.pango_font_description_set_size(handle, (int)(0.5f + size * OS.PANGO_SCALE));
    }
    OS.pango_font_description_set_stretch(handle, OS.PANGO_STRETCH_NORMAL);
    int pangoStyle = OS.PANGO_STYLE_NORMAL;
    int pangoWeight = OS.PANGO_WEIGHT_NORMAL;
    if ((style & SWT.ITALIC) != 0) pangoStyle = OS.PANGO_STYLE_ITALIC;
    if ((style & SWT.ROMAN) != 0) pangoStyle = OS.PANGO_STYLE_OBLIQUE;
    if ((style & SWT.BOLD) != 0) pangoWeight = OS.PANGO_WEIGHT_BOLD;
    OS.pango_font_description_set_style(handle, pangoStyle);
    OS.pango_font_description_set_weight(handle, pangoWeight);
  }
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

if ((extraTraits & OS.NSItalicFontMask) != 0) style |= SWT.ITALIC;
if ((extraTraits & OS.NSBoldFontMask) != 0) style |= SWT.BOLD;
Point dpi = device.dpi, screenDPI = device.getScreenDPI();
FontData data = new FontData(name, (float)/*64*/handle.pointSize() * screenDPI.y / dpi.y, style);
data.nsName = nsName;

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void init(String name, float height, int style, String nsName) {
  if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
  if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
  Point dpi = device.dpi, screenDPI = device.getScreenDPI();
  float size = height * dpi.y / screenDPI.y;
  if (nsName != null) {

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

Point dpi = this.dpi = getDPI(), screenDPI = getScreenDPI();
NSFont font = NSFont.systemFontOfSize(systemFontSize * dpi.y / screenDPI.y);
font.retain();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

Point dpi = getDPI(), screenDPI = getScreenDPI();
if (dpi.y != screenDPI.y) {
  int size = OS.pango_font_description_get_size(defaultFont);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

Point dpi = getDPI(), screenDPI = getScreenDPI();
if (dpi.y != screenDPI.y) {
  int size = OS.pango_font_description_get_size(defaultFont);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

Point dpi = getDPI(), screenDPI = getScreenDPI();
if (dpi.y != screenDPI.y) {
  int size = OS.pango_font_description_get_size(defaultFont);

相关文章