Bug #4849
Swing font size on laptop with HiDPI is too big
0%
Related issues
History
#1 Updated by Greg Shah almost 4 years ago
- Related to Bug #4135: high dpi screens display in low dpi added
#2 Updated by Greg Shah almost 4 years ago
The #4135 is specific to the web client.
#3 Updated by Roger Borrello almost 4 years ago
- File bigfont.mkv added
This may be something only related to my hardware, but I am logging it anyway.
After recent NVIDIA driver update, my Swing client fonts are scaled way too big. See attached video. This is the ./uast/button/gui_event_mouse_test_static_frame_triggers_only_simple.p
testcase.
Below is my laptop configuration:
System: Host: rfb Kernel: 5.4.0-42-generic x86_64 bits: 64 compiler: gcc v: 7.5.0 Desktop: Cinnamon 4.4.8 wm: muffin dm: LightDM Distro: Linux Mint 19.3 Tricia base: Ubuntu 18.04 bionic Machine: Type: Laptop System: LENOVO product: 20MF000DUS v: ThinkPad X1 Extreme serial: <filter> Chassis: type: 10 serial: <filter> Mobo: LENOVO model: 20MF000DUS serial: <filter> UEFI: LENOVO v: N2EET46W (1.28 ) date: 03/18/2020 Battery: ID-1: BAT0 charge: 70.1 Wh condition: 71.6/80.4 Wh (89%) volts: 17.1/15.4 model: Celxpert 01AY969 serial: <filter> status: Unknown Device-1: hidpp_battery_0 model: Logitech MK700 serial: <filter> charge: 70% status: Discharging Device-2: hidpp_battery_1 model: Logitech Marathon Mouse/Performance Plus M705 serial: <filter> charge: 10% status: Discharging CPU: Topology: 6-Core model: Intel Core i7-8850H bits: 64 type: MT MCP arch: Kaby Lake rev: A L2 cache: 9216 KiB flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 62399 Speed: 800 MHz min/max: 800/4300 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 Graphics: Device-1: NVIDIA GP107M [GeForce GTX 1050 Ti Mobile] driver: nvidia v: 440.100 bus ID: 01:00.0 chip ID: 10de:1c8c Display: x11 server: X.Org 1.20.8 driver: nvidia resolution: 1920x1080~60Hz, 1920x1080~60Hz, 3840x2160~60Hz OpenGL: renderer: GeForce GTX 1050 Ti with Max-Q Design/PCIe/SSE2 v: 4.6.0 NVIDIA 440.100 direct render: Yes Audio: Device-1: Intel Cannon Lake PCH cAVS vendor: Lenovo driver: snd_hda_intel v: kernel bus ID: 00:1f.3 chip ID: 8086:a348 Device-2: NVIDIA GP107GL High Definition Audio driver: snd_hda_intel v: kernel bus ID: 01:00.1 chip ID: 10de:0fb9 Device-3: Logitech HD Pro Webcam C920 type: USB driver: snd-usb-audio,uvcvideo bus ID: 1-1.2:17 chip ID: 046d:082d Device-4: GN Netcom type: USB driver: jabra,snd-usb-audio,usbhid bus ID: 1-1.1:16 chip ID: 0b0e:1041 Sound Server: ALSA v: k5.4.0-42-generic Network: Device-1: Intel Wireless-AC 9560 [Jefferson Peak] driver: iwlwifi v: kernel bus ID: 00:14.3 chip ID: 8086:a370 IF: wlp0s20f3 state: down mac: <filter> Device-2: Intel Ethernet I219-LM vendor: Lenovo driver: e1000e v: 3.2.6-k port: efa0 bus ID: 00:1f.6 chip ID: 8086:15bb IF: enp0s31f6 state: up speed: 1000 Mbps duplex: full mac: <filter> Drives: Local Storage: total: 953.87 GiB used: 353.54 GiB (37.1%) ID-1: /dev/nvme0n1 vendor: Samsung model: MZVLB1T0HALR-000L7 size: 953.87 GiB speed: 31.6 Gb/s lanes: 4 serial: <filter> Partition: ID-1: / size: 914.76 GiB used: 352.54 GiB (38.5%) fs: ext4 dev: /dev/dm-1 ID-2: /boot size: 704.5 MiB used: 244.9 MiB (34.8%) fs: ext4 dev: /dev/nvme0n1p2 ID-3: swap-1 size: 976.0 MiB used: 781.4 MiB (80.1%) fs: swap dev: /dev/dm-2 Sensors: System Temperatures: cpu: 52.0 C mobo: 51.0 C gpu: nvidia temp: 52 C Fan Speeds (RPM): cpu: 2187 Repos: No active apt repos in: /etc/apt/sources.list No active apt repos in: /etc/apt/sources.list.d/additional-repositories.list No active apt repos in: /etc/apt/sources.list.d/google-chrome.list Active apt repos in: /etc/apt/sources.list.d/graphics-drivers-ppa-bionic.list 1: deb http: //ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic main Active apt repos in: /etc/apt/sources.list.d/official-package-repositories.list 1: deb http: //packages.linuxmint.com tricia main upstream import backport 2: deb http: //archive.ubuntu.com/ubuntu bionic main restricted universe multiverse 3: deb http: //archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse 4: deb http: //archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse 5: deb http: //security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse 6: deb http: //archive.canonical.com/ubuntu/ bionic partner Active apt repos in: /etc/apt/sources.list.d/official-source-repositories.list 1: deb-src http: //packages.linuxmint.com tricia main upstream import backport 2: deb-src http: //archive.ubuntu.com/ubuntu bionic main restricted universe multiverse 3: deb-src http: //archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse 4: deb-src http: //archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse 5: deb-src http: //security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse 6: deb-src http: //archive.canonical.com/ubuntu/ bionic partner Active apt repos in: /etc/apt/sources.list.d/pgdg.list 1: deb http: //apt.postgresql.org/pub/repos/apt/ precise-pgdg main Info: Processes: 390 Uptime: 19d 15h 58m Memory: 30.86 GiB used: 23.79 GiB (77.1%) Init: systemd v: 237 runlevel: 5 Compilers: gcc: 7.5.0 alt: 7 Client: Unknown python3.6 client inxi: 3.0.32
#4 Updated by Roger Borrello almost 4 years ago
xrandr
output:
Screen 0: minimum 8 x 8, current 5760 x 1080, maximum 32767 x 32767 DP-0 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 477mm x 268mm 1920x1080 60.00*+ 59.94 50.00 1680x1050 59.95 1600x1200 60.00 1600x900 60.00 1440x900 59.89 1440x576 50.00 1400x1050 59.98 1280x1024 75.02 60.02 1280x960 60.00 1280x800 59.81 1280x720 60.00 59.94 50.00 1024x768 75.03 70.07 60.00 800x600 75.00 72.19 60.32 56.25 720x576 50.00 720x480 59.94 640x480 75.00 72.81 59.94 59.93 DP-1 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 477mm x 268mm 1920x1080 60.00*+ 59.94 50.00 1680x1050 59.95 1600x1200 60.00 1600x900 60.00 1440x900 59.89 1440x576 50.00 1400x1050 59.98 1280x1024 75.02 60.02 1280x960 60.00 1280x800 59.81 1280x720 60.00 59.94 50.00 1024x768 75.03 70.07 60.00 800x600 75.00 72.19 60.32 56.25 720x576 50.00 720x480 59.94 640x480 75.00 72.81 59.94 59.93 HDMI-0 disconnected (normal left inverted right x axis y axis) DP-2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm 3840x2160 60.00*+
#5 Updated by Roger Borrello almost 4 years ago
- File 20200811_NVIDIA-X-Server-Settings_1.png added
- File 20200811_NVIDIA-X-Server-Settings_3.png added
- File 20200811_NVIDIA-X-Server-Settings_2.png added
- File 20200811_NVIDIA-X-Server-Settings_0.png added
NVIDIA settings.
#6 Updated by Roger Borrello almost 4 years ago
- Subject changed from Font size on laptop with HiDPI is too big to Swing font size on laptop with HiDPI is too big
#7 Updated by Roger Borrello almost 4 years ago
Font related message logged in server.log:
[08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:SEVERE) Could not load the legacy font metrics from file font-metrics-ext.xml [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:SEVERE) Could not load the legacy text metrics from file text-metrics.xml [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) No custom fonts are defined in the directory. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [lato,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,true,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:48:14 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,7,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [lato,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,true,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:48:29 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,7,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [lato,8,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,true,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:50:08 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,7,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [lato,8,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,true,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:51:03 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,7,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [lato,8,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation sans,8,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,true,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 15:53:12 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,7,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,9,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [lato,8,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation sans,8,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [liberation mono,8,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,8,true,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,10,false,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [dejavu sans,10,true,false,false] has no legacy metrics. [08/11/2020 16:03:26 EDT] (com.goldencode.p2j.ui.FontTable:WARNING) Font [open sans,7,false,false,false] has no legacy metrics.
#8 Updated by Roger Borrello almost 4 years ago
I am looking through SwingGuiDriver
, based upon the default-font
being used, which is ms sans serif,8,false,false,false
, alias of lato,8,false,false,false
.
It is looking to see if either is installed in isFontInstalled()
. They are not in the fontFamilies
that was returned from awt
:
[aakar, Abyssinica SIL, Ani, AnjaliOldLipi, Bitstream Charter, Century Schoolbook L, Chandas, Chilanka, Courier 10 Pitch, DejaVu Sans, DejaVu Sans Mono, DejaVu Serif, Dialog, DialogInput, Dingbats, Droid Sans Fallback, Dyuthi, FreeMono, FreeSans, FreeSerif, Gargi, Garuda, Gubbi, Jamrul, KacstArt, KacstBook, KacstDecorative, KacstDigital, KacstFarsi, KacstLetter, KacstNaskh, KacstOffice, KacstOne, KacstPen, KacstPoster, KacstQurn, KacstScreen, KacstTitle, KacstTitleL, Kalapi, Kalimati, Karumbi, Keraleeyam, Khmer OS, Khmer OS System, Kinnari, Laksaman, Liberation Mono, Liberation Sans, Liberation Sans Narrow, Liberation Serif, Likhan, LKLUG, Lohit Assamese, Lohit Bengali, Lohit Devanagari, Lohit Gujarati, Lohit Gurmukhi, Lohit Kannada, Lohit Malayalam, Lohit Odia, Lohit Tamil, Lohit Tamil Classical, Lohit Telugu, Loma, Manjari Bold, Manjari Regular, Manjari Thin, MathJax_AMS, MathJax_Caligraphic, MathJax_Fraktur, MathJax_Main, MathJax_Math, MathJax_SansSerif, MathJax_Script, MathJax_Size1, MathJax_Size2, MathJax_Size3, MathJax_Size4, MathJax_Typewriter, MathJax_Vector, MathJax_Vector-Bold, MathJax_WinChrome, MathJax_WinIE6, Meera, Mitra Mono, Monospaced, mry_KacstQurn, Mukti Narrow, Nakula, Navilu, Nimbus Mono L, Nimbus Roman No9 L, Nimbus Sans L, Norasi, Noto Color Emoji, Noto Mono, Noto Sans CJK HK, Noto Sans CJK JP, Noto Sans CJK KR, Noto Sans CJK SC, Noto Sans CJK TC, Noto Sans Mono CJK HK, Noto Sans Mono CJK JP, Noto Sans Mono CJK KR, Noto Sans Mono CJK SC, Noto Sans Mono CJK TC, Noto Serif CJK JP, Noto Serif CJK KR, Noto Serif CJK SC, Noto Serif CJK TC, OpenSymbol, Padauk, Padauk Book, padmaa, padmaa-Bold.1.1, Pagul, Phetsarath OT, Pothana2000, Purisa, Rachana, RaghuMalayalam, Rekha, Saab, Sahadeva, Samanata, Samyak Devanagari, Samyak Gujarati, Samyak Malayalam, Samyak Tamil, SansSerif, Sarai, Sawasdee, Serif, Standard Symbols L, Suruma, Tibetan Machine Uni, Tlwg Typist, Tlwg Typo, TlwgMono, TlwgTypewriter, Ubuntu, Ubuntu Condensed, Ubuntu Light, Ubuntu Mono, Umpush, Uroob, URW Bookman L, URW Chancery L, URW Gothic L, URW Palladio L, utkal, Vemana2000, Waree]
So it creates a font with these details:
FontDetails { key='lato,8,false,false,false', fontName='Lato', style=PLAIN, pointSize=8, legacyWidth=-1, legacyMaxWidth=-1, legacyHeight=-1, fixedSize=false, boldFontDefinition=false, fontAlias=null, swingAntiAliasing=true }
awt derives a 2D font from the parent:
** TrueType Font: Family=Lato Name=Lato Regular style=0 fileName=/tmp/+~JF3649713377591502892.tmp
So SwingGuiDriver.createFont
returns the created font:
FontDetails { key='ms sans serif,8,false,false,false', fontName='Lato Regular', style=PLAIN, pointSize=8, legacyWidth=3, legacyMaxWidth=5, legacyHeight=8, fixedSize=false, boldFontDefinition=false, fontAlias= FontDetails { key='lato,8,false,false,false', fontName='Lato', style=PLAIN, pointSize=8, legacyWidth=-1, legacyMaxWidth=-1, legacyHeight=-1, fixedSize=false, boldFontDefinition=false, fontAlias=null, swingAntiAliasing=true }, swingAntiAliasing=true }
FontManager.createFont
then calls AbstractGuiDriver.scaleFont
Here the font.legacyHeight
and font.legacyWidth
are determined to be present, so SwingEmulatedWindow.getFontMetrics
returns a FontMetricsHelper
with a call getNativeFontMetrics
, and then javax.swing.JComponent.getFontMetrics
. This returns DEFAULT_FRC
.
Using this FontMetricsHelper
, it calculates and average width of a character set (0x20 to 0xff). The individual character with comes from the sun.font.FontDesignMetrics.getLaticCharWidth
, since it is less than 0x100. It looks up the character in advCache
, but this is set to all UNKNOWN_WIDTH
, so on-the-fly it sets the advCache
value for that character to handleCharWidth(ch)
.
handleCharWidth
is using FileFontStrike.getCodePointAdvance
to look up the width.
This uses getGlyphAdvance
after mapping the character to the glyph with sun.font.TrueTypeGlyphMapper
. At this point, we delve into the bowels of glyph calcuation, utilizing TrueType standard, and the platform. It returns 2.0
for the "space". FontDesignMetric.charWidth
returns rounded up to the next integer of that value ((int)0.5+w
).
Eventually, 5.0
is calculated as the average width. The height is returned from the FontDesignMetrics.height
, which is 10.
At this point, scaleFont
is checking to see if 5 != legacyWidth, or 10 != legacyHeight. It doesn't, so SwingGuiDriver.deriveFont
wantes to scale the font to the screen resolution. This is probably where things go sideways, since depending upon what you look at, my screen resolution is uber small, so it might want to make things uber big. Let's see...
getScreenResolution
is using java.awt.Toolkit.getDefaultToolkit
to get sun.awt.X11.XToolkit
. So su.awt.X11.XToolkit.getScreenResolution()
find the default display (139831266447200
).
return (int) ((XlibWrapper.DisplayWidth(display, XlibWrapper.DefaultScreen(display)) * 25.4) / XlibWrapper.DisplayWidthMM(display, XlibWrapper.DefaultScreen(display)));
I can't debug into
XlibWrapper
, but the return value is 286
Something to know about my configuration. My primary screen is supposed to be an external monitor. But whenever I run Swing FWD applications, they pop on my laptop, which is not supposed to be my primary screen. This may be a bug in FWD, or more likely the awt toolkit not returning the correct display.
The FontHelper.deriveFont
wants to use that value to determine what factor to use. (fd.pointSize * screenRes / 72.0
). I am changing it from 286
to 72
.
Lo-and-behold, the font is scaled properly!
So there could be a couple of things happening. It could be that the NVIDIA native are scaling thing for the HiDPI monitor, such that X11 is fooled, and believes everything is HiDPI. Or the Xtoolkit is not asking the correct driver. I imagine if we determined the correct default monitor to be an external monitor, it would behave properly.
#9 Updated by Roger Borrello almost 4 years ago
By switching my resolution using the X control panel, and making my laptop monitor actually have the 3840x2160 resolution, the fonts are not scaled up. However, it is so small, it should be scaled up. By moving the application to an external monitor with 1920x1080 resolution, I can see the application.
While this may be low priority, we are not supporing HiDPI displays very well. I believe the XToolkit calls are determining the actual hardware capabilities, but should be determining what resolution the display is set to. In my case, the driver was already scaling the fonts for me, so no additional scaling is necessary.