matthiasblaesing commented on issue #6300:
URL: https://github.com/apache/netbeans/issues/6300#issuecomment-6692380298

   I think we are seeing different issues here. For Fedora I reproduced this 
with the 44 live DVD environment. I also found the core issue. "Monospaced" is 
not a single font, but a compound of multiple fonts:
   
   <img width="1137" height="547" alt="Image" 
src="https://github.com/user-attachments/assets/ca387204-aedf-4d3d-bd12-9d66f4d8194b";
 />
   
   The code looks like this:
   
   ```java
   import java.awt.Font;
   import java.awt.font.FontRenderContext;
   
   public class FontWidth {
   
       public static void main(String[] args) {
           Font monospaced = new Font("Monospaced", 0, 15);
           Font adwaitaSans = new Font("Adwaita Mono", 0, 15);
           FontRenderContext fcr = new FontRenderContext() {
           };
           System.out.println(monospaced);
           System.out.println(adwaitaSans);
           for (char i = 0; i < 256; i++) {
               double notoWidth = monospaced.getStringBounds(new char[]{i}, 0, 
1, fcr).getWidth();
               double adwaitaWidth = adwaitaSans.getStringBounds(new char[]{i}, 
0, 1, fcr).getWidth();
               System.out.printf("%d\t%x\t%s\t%.2f\t%.2f\n", (int) i, (int) i, 
Character.isISOControl(i) ? "" : i, notoWidth, adwaitaWidth);
           }
       }
   }
   ```
   
   The screenshot shows the inspection of `monospaced`. The code above results 
in the following output. For a real monospace font the width should be uniform. 
The second to last column shows the width for `Monospaced`, the last column 
shows `Adwaita Mono`:
   
   <details>
   <summary>Widths broken</summary>
   
   ```
   java.awt.Font[family=Monospaced,name=Monospaced,style=plain,size=15]
   java.awt.Font[family=Adwaita Mono,name=Adwaita Mono,style=plain,size=15]
   0    0               0.00    9.00
   1    1               9.00    9.00
   2    2               9.00    9.00
   3    3               9.00    9.00
   4    4               9.00    9.00
   5    5               9.00    9.00
   6    6               9.00    9.00
   7    7               9.00    9.00
   8    8               9.00    9.00
   9    9               0.00    0.00
   10   a               0.00    0.00
   11   b               0.00    0.00
   12   c               0.00    0.00
   13   d               0.00    0.00
   14   e               9.00    9.00
   15   f               9.00    9.00
   16   10              9.00    9.00
   17   11              9.00    9.00
   18   12              9.00    9.00
   19   13              9.00    9.00
   20   14              9.00    9.00
   21   15              9.00    9.00
   22   16              9.00    9.00
   23   17              9.00    9.00
   24   18              9.00    9.00
   25   19              9.00    9.00
   26   1a              9.00    9.00
   27   1b              9.00    9.00
   28   1c              9.00    9.00
   29   1d              9.00    9.00
   30   1e              9.00    9.00
   31   1f              9.00    9.00
   32   20              9.00    9.00
   33   21      !       9.00    9.00
   34   22      "       9.00    9.00
   35   23      #       9.00    9.00
   36   24      $       8.00    9.00
   37   25      %       9.00    9.00
   38   26      &       9.00    9.00
   39   27      '       9.00    9.00
   40   28      (       9.00    9.00
   41   29      )       9.00    9.00
   42   2a      *       9.00    9.00
   43   2b      +       9.00    9.00
   44   2c      ,       9.00    9.00
   45   2d      -       9.00    9.00
   46   2e      .       10.00   9.00
   47   2f      /       9.00    9.00
   48   30      0       9.00    9.00
   49   31      1       9.00    9.00
   50   32      2       9.00    9.00
   51   33      3       9.00    9.00
   52   34      4       9.00    9.00
   53   35      5       9.00    9.00
   54   36      6       9.00    9.00
   55   37      7       9.00    9.00
   56   38      8       9.00    9.00
   57   39      9       9.00    9.00
   58   3a      :       10.00   9.00
   59   3b      ;       9.00    9.00
   60   3c      <       9.00    9.00
   61   3d      =       9.00    9.00
   62   3e      >       9.00    9.00
   63   3f      ?       8.00    9.00
   64   40      @       11.00   9.00
   65   41      A       9.00    9.00
   66   42      B       9.00    9.00
   67   43      C       9.00    9.00
   68   44      D       9.00    9.00
   69   45      E       8.00    9.00
   70   46      F       8.00    9.00
   71   47      G       9.00    9.00
   72   48      H       9.00    9.00
   73   49      I       10.00   9.00
   74   4a      J       8.00    9.00
   75   4b      K       9.00    9.00
   76   4c      L       9.00    9.00
   77   4d      M       9.00    9.00
   78   4e      N       9.00    9.00
   79   4f      O       9.00    9.00
   80   50      P       9.00    9.00
   81   51      Q       9.00    9.00
   82   52      R       8.00    9.00
   83   53      S       8.00    9.00
   84   54      T       10.00   9.00
   85   55      U       9.00    9.00
   86   56      V       9.00    9.00
   87   57      W       9.00    9.00
   88   58      X       9.00    9.00
   89   59      Y       9.00    9.00
   90   5a      Z       8.00    9.00
   91   5b      [       9.00    9.00
   92   5c      \       9.00    9.00
   93   5d      ]       9.00    9.00
   94   5e      ^       9.00    9.00
   95   5f      _       9.00    9.00
   96   60      `       9.00    9.00
   97   61      a       8.00    9.00
   98   62      b       9.00    9.00
   99   63      c       9.00    9.00
   100  64      d       9.00    9.00
   101  65      e       9.00    9.00
   102  66      f       9.00    9.00
   103  67      g       9.00    9.00
   104  68      h       9.00    9.00
   105  69      i       10.00   9.00
   106  6a      j       9.00    9.00
   107  6b      k       9.00    9.00
   108  6c      l       9.00    9.00
   109  6d      m       9.00    9.00
   110  6e      n       9.00    9.00
   111  6f      o       9.00    9.00
   112  70      p       9.00    9.00
   113  71      q       9.00    9.00
   114  72      r       8.00    9.00
   115  73      s       10.00   9.00
   116  74      t       9.00    9.00
   117  75      u       9.00    9.00
   118  76      v       9.00    9.00
   119  77      w       9.00    9.00
   120  78      x       9.00    9.00
   121  79      y       9.00    9.00
   122  7a      z       8.00    9.00
   123  7b      {       9.00    9.00
   124  7c      |       9.00    9.00
   125  7d      }       9.00    9.00
   126  7e      ~       9.00    9.00
   127  7f              0.00    9.00
   128  80              9.00    9.00
   129  81              9.00    9.00
   130  82              9.00    9.00
   131  83              9.00    9.00
   132  84              9.00    9.00
   133  85              0.00    0.00
   134  86              9.00    9.00
   135  87              9.00    9.00
   136  88              9.00    9.00
   137  89              9.00    9.00
   138  8a              9.00    9.00
   139  8b              9.00    9.00
   140  8c              9.00    9.00
   141  8d              9.00    9.00
   142  8e              9.00    9.00
   143  8f              9.00    9.00
   144  90              9.00    9.00
   145  91              9.00    9.00
   146  92              9.00    9.00
   147  93              9.00    9.00
   148  94              9.00    9.00
   149  95              9.00    9.00
   150  96              9.00    9.00
   151  97              9.00    9.00
   152  98              9.00    9.00
   153  99              9.00    9.00
   154  9a              9.00    9.00
   155  9b              9.00    9.00
   156  9c              9.00    9.00
   157  9d              9.00    9.00
   158  9e              7.00    9.00
   159  9f              9.00    9.00
   160  a0              9.00    9.00
   161  a1      ¡       9.00    9.00
   162  a2      ¢       8.00    9.00
   163  a3      £       9.00    9.00
   164  a4      ¤       9.00    9.00
   165  a5      ¥       9.00    9.00
   166  a6      ¦       9.00    9.00
   167  a7      §       9.00    9.00
   168  a8      ¨       9.00    9.00
   169  a9      ©       10.00   9.00
   170  aa      ª       9.00    9.00
   171  ab      «       9.00    9.00
   172  ac      ¬       9.00    9.00
   173  ad      ­       0.00    0.00
   174  ae      ®       10.00   9.00
   175  af      ¯       8.00    9.00
   176  b0      °       9.00    9.00
   177  b1      ±       9.00    9.00
   178  b2      ²       8.00    9.00
   179  b3      ³       8.00    9.00
   180  b4      ´       9.00    9.00
   181  b5      µ       9.00    9.00
   182  b6      ¶       9.00    9.00
   183  b7      ·       10.00   9.00
   184  b8      ¸       9.00    9.00
   185  b9      ¹       9.00    9.00
   186  ba      º       8.00    9.00
   187  bb      »       9.00    9.00
   188  bc      ¼       9.00    9.00
   189  bd      ½       10.00   9.00
   190  be      ¾       9.00    9.00
   191  bf      ¿       10.00   9.00
   192  c0      À       9.00    9.00
   193  c1      Á       9.00    9.00
   194  c2      Â       9.00    9.00
   195  c3      Ã       9.00    9.00
   196  c4      Ä       9.00    9.00
   197  c5      Å       9.00    9.00
   198  c6      Æ       9.00    9.00
   199  c7      Ç       9.00    9.00
   200  c8      È       8.00    9.00
   201  c9      É       8.00    9.00
   202  ca      Ê       8.00    9.00
   203  cb      Ë       8.00    9.00
   204  cc      Ì       10.00   9.00
   205  cd      Í       10.00   9.00
   206  ce      Î       10.00   9.00
   207  cf      Ï       10.00   9.00
   208  d0      Ð       9.00    9.00
   209  d1      Ñ       9.00    9.00
   210  d2      Ò       9.00    9.00
   211  d3      Ó       9.00    9.00
   212  d4      Ô       9.00    9.00
   213  d5      Õ       9.00    9.00
   214  d6      Ö       9.00    9.00
   215  d7      ×       9.00    9.00
   216  d8      Ø       9.00    9.00
   217  d9      Ù       9.00    9.00
   218  da      Ú       9.00    9.00
   219  db      Û       9.00    9.00
   220  dc      Ü       9.00    9.00
   221  dd      Ý       9.00    9.00
   222  de      Þ       9.00    9.00
   223  df      ß       9.00    9.00
   224  e0      à       8.00    9.00
   225  e1      á       8.00    9.00
   226  e2      â       8.00    9.00
   227  e3      ã       8.00    9.00
   228  e4      ä       8.00    9.00
   229  e5      å       8.00    9.00
   230  e6      æ       11.00   9.00
   231  e7      ç       9.00    9.00
   232  e8      è       9.00    9.00
   233  e9      é       9.00    9.00
   234  ea      ê       9.00    9.00
   235  eb      ë       9.00    9.00
   236  ec      ì       9.00    9.00
   237  ed      í       9.00    9.00
   238  ee      î       9.00    9.00
   239  ef      ï       9.00    9.00
   240  f0      ð       9.00    9.00
   241  f1      ñ       9.00    9.00
   242  f2      ò       9.00    9.00
   243  f3      ó       9.00    9.00
   244  f4      ô       9.00    9.00
   245  f5      õ       9.00    9.00
   246  f6      ö       9.00    9.00
   247  f7      ÷       9.00    9.00
   248  f8      ø       9.00    9.00
   249  f9      ù       9.00    9.00
   250  fa      ú       9.00    9.00
   251  fb      û       9.00    9.00
   252  fc      ü       9.00    9.00
   253  fd      ý       9.00    9.00
   254  fe      þ       9.00    9.00
   255  ff      ÿ       9.00    9.00
   ```
   </details>
   
   In my experiment this was trivally fixed by installing the full "Noto Sans 
Mono" font:
   
   ```
   yum install google-noto-sans-mono-fonts.noarch
   ```
   
   After that the selection problem is gone and the widths make more sense:
   
   <details>
   <summary>Widths improved</summary>
   
   ```
   0    0               0.00    9.00
   1    1               9.00    9.00
   2    2               9.00    9.00
   3    3               9.00    9.00
   4    4               9.00    9.00
   5    5               9.00    9.00
   6    6               9.00    9.00
   7    7               9.00    9.00
   8    8               9.00    9.00
   9    9               0.00    0.00
   10   a               0.00    0.00
   11   b               0.00    0.00
   12   c               0.00    0.00
   13   d               0.00    0.00
   14   e               9.00    9.00
   15   f               9.00    9.00
   16   10              9.00    9.00
   17   11              9.00    9.00
   18   12              9.00    9.00
   19   13              9.00    9.00
   20   14              9.00    9.00
   21   15              9.00    9.00
   22   16              9.00    9.00
   23   17              9.00    9.00
   24   18              9.00    9.00
   25   19              9.00    9.00
   26   1a              9.00    9.00
   27   1b              9.00    9.00
   28   1c              9.00    9.00
   29   1d              9.00    9.00
   30   1e              9.00    9.00
   31   1f              9.00    9.00
   32   20              9.00    9.00
   33   21      !       9.00    9.00
   34   22      "       9.00    9.00
   35   23      #       9.00    9.00
   36   24      $       9.00    9.00
   37   25      %       9.00    9.00
   38   26      &       9.00    9.00
   39   27      '       9.00    9.00
   40   28      (       9.00    9.00
   41   29      )       9.00    9.00
   42   2a      *       9.00    9.00
   43   2b      +       9.00    9.00
   44   2c      ,       9.00    9.00
   45   2d      -       9.00    9.00
   46   2e      .       9.00    9.00
   47   2f      /       9.00    9.00
   48   30      0       9.00    9.00
   49   31      1       9.00    9.00
   50   32      2       9.00    9.00
   51   33      3       9.00    9.00
   52   34      4       9.00    9.00
   53   35      5       9.00    9.00
   54   36      6       9.00    9.00
   55   37      7       9.00    9.00
   56   38      8       9.00    9.00
   57   39      9       9.00    9.00
   58   3a      :       9.00    9.00
   59   3b      ;       9.00    9.00
   60   3c      <       9.00    9.00
   61   3d      =       9.00    9.00
   62   3e      >       9.00    9.00
   63   3f      ?       9.00    9.00
   64   40      @       9.00    9.00
   65   41      A       9.00    9.00
   66   42      B       9.00    9.00
   67   43      C       9.00    9.00
   68   44      D       9.00    9.00
   69   45      E       9.00    9.00
   70   46      F       9.00    9.00
   71   47      G       9.00    9.00
   72   48      H       9.00    9.00
   73   49      I       9.00    9.00
   74   4a      J       9.00    9.00
   75   4b      K       9.00    9.00
   76   4c      L       9.00    9.00
   77   4d      M       9.00    9.00
   78   4e      N       9.00    9.00
   79   4f      O       9.00    9.00
   80   50      P       9.00    9.00
   81   51      Q       9.00    9.00
   82   52      R       9.00    9.00
   83   53      S       9.00    9.00
   84   54      T       9.00    9.00
   85   55      U       9.00    9.00
   86   56      V       9.00    9.00
   87   57      W       9.00    9.00
   88   58      X       9.00    9.00
   89   59      Y       9.00    9.00
   90   5a      Z       9.00    9.00
   91   5b      [       9.00    9.00
   92   5c      \       9.00    9.00
   93   5d      ]       9.00    9.00
   94   5e      ^       9.00    9.00
   95   5f      _       9.00    9.00
   96   60      `       9.00    9.00
   97   61      a       9.00    9.00
   98   62      b       9.00    9.00
   99   63      c       9.00    9.00
   100  64      d       9.00    9.00
   101  65      e       9.00    9.00
   102  66      f       9.00    9.00
   103  67      g       9.00    9.00
   104  68      h       9.00    9.00
   105  69      i       9.00    9.00
   106  6a      j       9.00    9.00
   107  6b      k       9.00    9.00
   108  6c      l       9.00    9.00
   109  6d      m       9.00    9.00
   110  6e      n       9.00    9.00
   111  6f      o       9.00    9.00
   112  70      p       9.00    9.00
   113  71      q       9.00    9.00
   114  72      r       9.00    9.00
   115  73      s       9.00    9.00
   116  74      t       9.00    9.00
   117  75      u       9.00    9.00
   118  76      v       9.00    9.00
   119  77      w       9.00    9.00
   120  78      x       9.00    9.00
   121  79      y       9.00    9.00
   122  7a      z       9.00    9.00
   123  7b      {       9.00    9.00
   124  7c      |       9.00    9.00
   125  7d      }       9.00    9.00
   126  7e      ~       9.00    9.00
   127  7f              0.00    9.00
   128  80              9.00    9.00
   129  81              9.00    9.00
   130  82              9.00    9.00
   131  83              9.00    9.00
   132  84              9.00    9.00
   133  85              0.00    0.00
   134  86              9.00    9.00
   135  87              9.00    9.00
   136  88              9.00    9.00
   137  89              9.00    9.00
   138  8a              9.00    9.00
   139  8b              9.00    9.00
   140  8c              9.00    9.00
   141  8d              9.00    9.00
   142  8e              9.00    9.00
   143  8f              9.00    9.00
   144  90              9.00    9.00
   145  91              9.00    9.00
   146  92              9.00    9.00
   147  93              9.00    9.00
   148  94              9.00    9.00
   149  95              9.00    9.00
   150  96              9.00    9.00
   151  97              9.00    9.00
   152  98              9.00    9.00
   153  99              9.00    9.00
   154  9a              9.00    9.00
   155  9b              9.00    9.00
   156  9c              9.00    9.00
   157  9d              9.00    9.00
   158  9e              7.00    9.00
   159  9f              9.00    9.00
   160  a0              9.00    9.00
   161  a1      ¡       9.00    9.00
   162  a2      ¢       9.00    9.00
   163  a3      £       9.00    9.00
   164  a4      ¤       9.00    9.00
   165  a5      ¥       9.00    9.00
   166  a6      ¦       9.00    9.00
   167  a7      §       9.00    9.00
   168  a8      ¨       9.00    9.00
   169  a9      ©       9.00    9.00
   170  aa      ª       9.00    9.00
   171  ab      «       9.00    9.00
   172  ac      ¬       9.00    9.00
   173  ad      ­       0.00    0.00
   174  ae      ®       9.00    9.00
   175  af      ¯       9.00    9.00
   176  b0      °       9.00    9.00
   177  b1      ±       9.00    9.00
   178  b2      ²       9.00    9.00
   179  b3      ³       9.00    9.00
   180  b4      ´       9.00    9.00
   181  b5      µ       9.00    9.00
   182  b6      ¶       9.00    9.00
   183  b7      ·       9.00    9.00
   184  b8      ¸       9.00    9.00
   185  b9      ¹       9.00    9.00
   186  ba      º       9.00    9.00
   187  bb      »       9.00    9.00
   188  bc      ¼       9.00    9.00
   189  bd      ½       9.00    9.00
   190  be      ¾       9.00    9.00
   191  bf      ¿       9.00    9.00
   192  c0      À       9.00    9.00
   193  c1      Á       9.00    9.00
   194  c2      Â       9.00    9.00
   195  c3      Ã       9.00    9.00
   196  c4      Ä       9.00    9.00
   197  c5      Å       9.00    9.00
   198  c6      Æ       9.00    9.00
   199  c7      Ç       9.00    9.00
   200  c8      È       9.00    9.00
   201  c9      É       9.00    9.00
   202  ca      Ê       9.00    9.00
   203  cb      Ë       9.00    9.00
   204  cc      Ì       9.00    9.00
   205  cd      Í       9.00    9.00
   206  ce      Î       9.00    9.00
   207  cf      Ï       9.00    9.00
   208  d0      Ð       9.00    9.00
   209  d1      Ñ       9.00    9.00
   210  d2      Ò       9.00    9.00
   211  d3      Ó       9.00    9.00
   212  d4      Ô       9.00    9.00
   213  d5      Õ       9.00    9.00
   214  d6      Ö       9.00    9.00
   215  d7      ×       9.00    9.00
   216  d8      Ø       9.00    9.00
   217  d9      Ù       9.00    9.00
   218  da      Ú       9.00    9.00
   219  db      Û       9.00    9.00
   220  dc      Ü       9.00    9.00
   221  dd      Ý       9.00    9.00
   222  de      Þ       9.00    9.00
   223  df      ß       9.00    9.00
   224  e0      à       9.00    9.00
   225  e1      á       9.00    9.00
   226  e2      â       9.00    9.00
   227  e3      ã       9.00    9.00
   228  e4      ä       9.00    9.00
   229  e5      å       9.00    9.00
   230  e6      æ       9.00    9.00
   231  e7      ç       9.00    9.00
   232  e8      è       9.00    9.00
   233  e9      é       9.00    9.00
   234  ea      ê       9.00    9.00
   235  eb      ë       9.00    9.00
   236  ec      ì       9.00    9.00
   237  ed      í       9.00    9.00
   238  ee      î       9.00    9.00
   239  ef      ï       9.00    9.00
   240  f0      ð       9.00    9.00
   241  f1      ñ       9.00    9.00
   242  f2      ò       9.00    9.00
   243  f3      ó       9.00    9.00
   244  f4      ô       9.00    9.00
   245  f5      õ       9.00    9.00
   246  f6      ö       9.00    9.00
   247  f7      ÷       9.00    9.00
   248  f8      ø       9.00    9.00
   249  f9      ù       9.00    9.00
   250  fa      ú       9.00    9.00
   251  fb      û       9.00    9.00
   252  fc      ü       9.00    9.00
   253  fd      ý       9.00    9.00
   254  fe      þ       9.00    9.00
   255  ff      ÿ       9.00    9.00
   ```
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to