Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ public boolean equals(Object object) {
*/
public FontData[] getFontData() {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);

final int DOTS_PER_INCH = 96;
long family = OS.pango_font_description_get_family(handle);
int length = C.strlen(family);
byte[] buffer = new byte[length];
C.memmove(buffer, family, length);
String name = new String(Converter.mbcsToWcs(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;
Point dpi = device.dpi;
float size = height * DOTS_PER_INCH / dpi.y;
int pangoStyle = OS.pango_font_description_get_style(handle);
int pangoWeight = OS.pango_font_description_get_weight(handle);
int style = SWT.NORMAL;
Expand Down Expand Up @@ -254,8 +254,9 @@ public int hashCode() {
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;
final int DOTS_PER_INCH = 96;
Point dpi = device.dpi;
float size = height * dpi.y / DOTS_PER_INCH;
if (fontString != null) {
handle = OS.pango_font_description_from_string (fontString);
if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5053,7 +5053,8 @@ String debugInfoForIndex(long index) {
}

void dpiChanged(int newScaleFactor) {
DPIUtil.setDeviceZoom (DPIUtil.mapDPIToZoom(getDPI().x * newScaleFactor));
final int DOTS_PER_INCH = 96;
DPIUtil.setDeviceZoom (DPIUtil.mapDPIToZoom(DOTS_PER_INCH * newScaleFactor));
Shell[] shells = getShells();
for (int i = 0; i < shells.length; i++) {
shells[i].layout(true, true);
Expand Down
Loading