Old 06-06-2015, 01:12 PM   #1
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 4,801
Default Font size in scripts issue in different platforms Win vs Mac

It seems that this results in different font sizes in pixels between Windows and Mac. Mac being a bit bigger than Windows.
Code:
gfx.setfont(1,"Arial", 14)
gfx.drawstr("This is Arial font size 14")
Is Arial the same font and available in OSX as it is in Windows?
How can we make same font sizes on both platforms?
__________________
HeDaScripts for REAPER | VIP Donations
heda is offline   Reply With Quote
Old 06-06-2015, 02:08 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,238
Default

There is few common font (windows linux mac), the simplest list of that came from the web and are called web-safe-font.

There must be something different about how the text is rendered....
I will prepare a/b screenshot windows mac with your region manager window (which has a lot of text).
X-Raym is offline   Reply With Quote
Old 06-06-2015, 02:15 PM   #3
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 4,801
Default

try this too please
Code:
gfx.setfont(1,"Arial", 14)
gfx.drawstr("This is Arial font size 14")
w,h=gfx.measurestr("This is Arial font size 14")
reaper.ShowConsoleMsg("Width=" .. w)
reaper.ShowConsoleMsg("Height=" .. h)
and tell me if the numbers are different in OSX.
maybe we can find a proportion and do something like this
Code:
OS=reaper.GetOS()
if OS=="OSX32" or OS=="OSX64" then
  gfx.setfont(1,"Arial", 13.8)
else
  gfx.setfont(1,"Arial", 14)
end
edit: mmm I don't know... setting 13 or 13.9 seems to be the same font size in windows. it seems it only accepts integers.
__________________
HeDaScripts for REAPER | VIP Donations
heda is offline   Reply With Quote
Old 06-07-2015, 04:18 AM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,238
Default

it shows :

Code:
Width=150.0Height=18.0
I send you other screenshots in a moment.
X-Raym is offline   Reply With Quote
Old 06-07-2015, 05:07 AM   #5
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 4,801
Default

Quote:
Originally Posted by X-Raym View Post
it shows :

Code:
Width=150.0Height=18.0
I send you other screenshots in a moment.
in Windows 7 x64:
Width=116.0Height=14.0

so that's the problem

but I think we can't do anything
__________________
HeDaScripts for REAPER | VIP Donations
heda is offline   Reply With Quote
Old 06-07-2015, 05:51 AM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,238
Default

Can't a simple "os based coef multiplicator" do the tricks ?
If OSX then font size = font-size * 0.x ?

The minimum we can do is... bug report :P
X-Raym is offline   Reply With Quote
Old 06-07-2015, 06:03 AM   #7
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 4,801
Default

it doesn't work for me
maybe it works in Mc? I don't think so.. I think it only accepts integers, which is really strange

Quote:
Originally Posted by heda View Post
edit: mmm I don't know... setting 13 or 13.9 seems to be the same font size in windows. it seems it only accepts integers.
__________________
HeDaScripts for REAPER | VIP Donations
heda is offline   Reply With Quote
Old 03-19-2016, 05:03 AM   #8
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 4,801
Default

bumping this issue. Please fix

It's difficult to program for PC and MAC with different font sizes.

Specially when I don't have a Mac to test it.
Did I hear somebody wants to donate me an old unused mac for testing my scripts on Mac?
__________________
HeDaScripts for REAPER | VIP Donations
heda is offline   Reply With Quote
Old 03-19-2016, 05:06 AM   #9
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 2,209
Default

I use OSX in VirtualBox for testing these things (depending on font, and not always has same coefficient).
__________________
SoundCloud | MPL Scripts discussion | ReaPack | Donate
mpl is offline   Reply With Quote
Old 03-19-2016, 06:35 AM   #10
IXix
Human being with feelings
 
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,343
Default

I came across this too just recently. Would be good to have a solution.
IXix is offline   Reply With Quote
Old 03-19-2016, 11:10 AM   #11
ijijn
Human being with feelings
 
ijijn's Avatar
 
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 479
Default

Yes, it's a tricky business. Universality of appearance is why I started using bitmap/signed distance field fonts.
ijijn is offline   Reply With Quote
Old 03-21-2016, 02:24 AM   #12
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: City
Posts: 10,164
Default

What are good ones to pick for OSX and Windows that come installed on both systems ?
__________________
Dialogue/FX Editor & Re-Recording Mixer
(Video)Using Latch Preview
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 03-21-2016, 02:30 AM   #13
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,238
Default

I would say all kind of Web Safe Fonts

For eg, 16 Gorgeous Web Safe Fonts To Use With CSS
X-Raym is offline   Reply With Quote
Old 03-21-2016, 04:04 AM   #14
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 4,801
Default

I use Arial. so It doesn't seem to work with Arial at least
__________________
HeDaScripts for REAPER | VIP Donations
heda is offline   Reply With Quote
Old 12-05-2018, 04:20 AM   #15
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,341
Default

Guys, have you found any workaround this problem? I would like to fix this problem in my ReaNoir script.



I use Arial, which is supposed to be cross-platform, but apparently it is not..
Code:
gfx.setfont(1,"Arial", 15)
amagalma is offline   Reply With Quote
Old 12-05-2018, 04:23 AM   #16
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 608
Default

I simply would use a smaller font-size. If I remember correctly, using two smaller should work.
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-05-2018, 04:46 AM   #17
geraintluff
Human being with feelings
 
geraintluff's Avatar
 
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 276
Default

I've noticed this with JSFX as well.

Would it work to calibrate against a known string using gfx.measurestr()?

The JSFX equivalent would be:

Code:
gfx_setfont(1, "Arial", 15);

gfx_measurestr("MMMMMMMMMM", str_width, str_height);
font_factor = 90/str_width; // 90 is the width on Windows

gfx_setfont(1, "Arial", 15*font_factor);
I used the width because I've sometimes encountered ambiguity about "font height" vs. "line height" (e.g. includes a 20% padding) - I've no idea whether that's related to this issue or not.

Last edited by geraintluff; 12-05-2018 at 04:53 AM.
geraintluff is offline   Reply With Quote
Old 12-05-2018, 04:47 AM   #18
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,341
Default

@mespotine: Hmm.. But I don't want it to be smaller than it is in Windows...

@geraintluff: The problem is that font size must be an integer.. But I'll try it

Last edited by amagalma; 12-05-2018 at 04:53 AM.
amagalma is offline   Reply With Quote
Old 12-05-2018, 09:04 AM   #19
geraintluff
Human being with feelings
 
geraintluff's Avatar
 
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 276
Default

Quote:
Originally Posted by amagalma View Post
@geraintluff: The problem is that font size must be an integer.. But I'll try it
Seems like it worked! Guess I have to apply that fix to all of my own effects now...

Last edited by geraintluff; 12-05-2018 at 09:27 AM.
geraintluff is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.