Author Topic: Font Clipping  (Read 2189 times)

0 Members and 1 Guest are viewing this topic.

Offline xband

  • Newbie
  • Posts: 2
    • View Profile
Font Clipping
« on: July 15, 2019, 02:02:33 pm »
Some fonts are getting cut off at the top using _PRINTSTRING. It happens with consolas and a handful of other fonts.

Is this a bug?

Code: QB64: [Select]
  1. DIM mscreen AS INTEGER
  2. DIM rootpath AS STRING
  3. DIM fontfile AS STRING
  4. DIM fonthandle AS INTEGER
  5.  
  6. DIM xoffset AS INTEGER
  7. DIM yoffset AS INTEGER
  8.  
  9. DIM CH(1 TO 72) AS STRING
  10. FOR i = 1 TO 63
  11.     CH(i) = CHR$(33 + i)
  12. CH(64) = "{"
  13. CH(65) = "|"
  14. CH(66) = "}"
  15. CH(67) = "~"
  16. CH(68) = CHR$(30)
  17. CH(69) = CHR$(31)
  18. CH(70) = CHR$(16)
  19. CH(71) = CHR$(17)
  20. CH(72) = CHR$(1)
  21.  
  22.  
  23. rootpath = ENVIRON$("SYSTEMROOT")
  24. fontfile = "consola.ttf"
  25. fonthandle = _LOADFONT(fontfile, 60, "MONOSPACE")
  26.  
  27. mscreen = _NEWIMAGE(1024, 1024, 32)
  28. SCREEN mscreen
  29.  
  30. _FONT fonthandle, mscreen
  31. xoffset = 0
  32. yoffset = 0
  33.  
  34. '_CLEARCOLOR _RGB(0, 0, 0), mscreen
  35.  
  36.     CLS , _RGB(30, 30, 30)
  37.     '===============
  38.     xoffset = 0
  39.     yoffset = 0
  40.     FOR i = 1 TO 72
  41.         _PRINTSTRING (xoffset, yoffset), CH(i)
  42.         xoffset = xoffset + 64
  43.         IF xoffset > 960 THEN
  44.             xoffset = 0
  45.             yoffset = yoffset + 64
  46.         END IF
  47.     NEXT
  48.     '===============
  49.     _LIMIT 60
  50.     _DISPLAY
  51.  
  52.  
  53.  
« Last Edit: July 15, 2019, 02:06:48 pm by xband »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Font Clipping
« Reply #1 on: July 15, 2019, 02:09:27 pm »
Hi. It's a known bug. I wouldn't expect any repair anytime soon.
We talking about this year back.... https://www.qb64.org/forum/index.php?topic=247.msg1301;topicseen#msg1301
« Last Edit: July 15, 2019, 02:12:30 pm by Petr »

Offline xband

  • Newbie
  • Posts: 2
    • View Profile
Re: Font Clipping
« Reply #2 on: July 15, 2019, 02:18:09 pm »
ah ok, fortunately i was able to find a different font with a similar style that didn't clip. thanks.

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Font Clipping
« Reply #3 on: July 15, 2019, 08:58:43 pm »
OK, that explains the effect I'm seeing in my project, though it seems to manifest at different points inconsistently. Not a major issue as it can still be read well enough to tell what's going on.