|
|
|
06-06-2015, 01:12 PM
|
#1
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,238
|
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?
|
|
|
06-06-2015, 02:08 PM
|
#2
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
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).
|
|
|
06-06-2015, 02:15 PM
|
#3
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,238
|
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.
|
|
|
06-07-2015, 04:18 AM
|
#4
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
it shows :
Code:
Width=150.0Height=18.0
I send you other screenshots in a moment.
|
|
|
06-07-2015, 05:07 AM
|
#5
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,238
|
Quote:
Originally Posted by X-Raym
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
|
|
|
06-07-2015, 05:51 AM
|
#6
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,875
|
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
|
|
|
06-07-2015, 06:03 AM
|
#7
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,238
|
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
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.
|
|
|
|
03-19-2016, 05:03 AM
|
#8
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,238
|
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?
|
|
|
03-19-2016, 05:06 AM
|
#9
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
|
I use OSX in VirtualBox for testing these things (depending on font, and not always has same coefficient).
|
|
|
03-19-2016, 06:35 AM
|
#10
|
Human being with feelings
Join Date: Jan 2007
Location: mcr:uk
Posts: 3,889
|
I came across this too just recently. Would be good to have a solution.
|
|
|
03-19-2016, 11:10 AM
|
#11
|
Human being with feelings
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
|
Yes, it's a tricky business. Universality of appearance is why I started using bitmap/signed distance field fonts.
|
|
|
03-21-2016, 02:24 AM
|
#12
|
Human being with feelings
Join Date: Aug 2006
Location: Berlin
Posts: 11,817
|
What are good ones to pick for OSX and Windows that come installed on both systems ?
|
|
|
03-21-2016, 04:04 AM
|
#14
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,238
|
I use Arial. so It doesn't seem to work with Arial at least
|
|
|
12-05-2018, 04:20 AM
|
#15
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
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)
|
|
|
12-05-2018, 04:23 AM
|
#16
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
I simply would use a smaller font-size. If I remember correctly, using two smaller should work.
|
|
|
12-05-2018, 04:46 AM
|
#17
|
Human being with feelings
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 346
|
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.
|
|
|
12-05-2018, 04:47 AM
|
#18
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
@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.
|
|
|
12-05-2018, 09:04 AM
|
#19
|
Human being with feelings
Join Date: Nov 2009
Location: mostly inside my own head
Posts: 346
|
Quote:
Originally Posted by amagalma
@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.
|
|
|
07-12-2019, 08:20 AM
|
#20
|
Human being with feelings
Join Date: Nov 2006
Location: Finland
Posts: 1,528
|
Old thread, issue remains. Biggest problem being of course my favourite, Trebuchet MS, which is about half the size on Windows compared to Mac.
Here are a few 14 px fonts next to a 14 px tall square box. Note also that all images are 300*210 px in size.
Mac:
Windows:
Windows (another resolution):
Arial is not the best after all. Verdana is the closest on different platforms, but it is a very very wide font. Tahoma would be a good second, but it doesn't draw italic.
Has anyone found a font that I haven't thought of, that would (or even could) show roughly in the same size? One that also shows as italic and bold italic?
__________________
______ Announcing__mrelwood plugins______
.. MacBook Pro 16" Late '19 .. Scarlett 6i6, Saffire Pro 24 DSP (+ADA8000) .. FCA610 .. EVE SC207 .. Focal: Shape 65, Alpha 65, CMS 40, Listen Pro ..
|
|
|
07-12-2019, 08:51 AM
|
#21
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Oh, nice. Will add that to Ultraschall-API as gfx.setfont-alternative, if you don't mind...
|
|
|
07-12-2019, 08:55 AM
|
#22
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Sorry, deleted the post after seeing that it had already been covered above. Here's the full function I use:
Code:
-- Usage: Font.set("Arial", 10, "bi")
Font.set = function (font, size, flagStr)
-- Different OSes use different font sizes, for some reason
-- This should give a similar size on Mac/Linux as on Windows
if not string.match( reaper.GetOS(), "Win") then
size = math.floor(size * 0.8)
end
-- Cheers to Justin and Schwa for this
local flags = 0
if flagStr then
for i = 1, flagStr:len() do
flags = flags * 256 + string.byte(flagStr, i)
end
end
gfx.setfont(1, font, size, flags)
end
|
|
|
07-12-2019, 11:49 AM
|
#23
|
Human being with feelings
Join Date: Nov 2006
Location: Finland
Posts: 1,528
|
Quote:
Originally Posted by Lokasenna
Sorry, deleted the post after seeing that it had already been covered above. Here's the full function I use:
Code:
-- Usage: Font.set("Arial", 10, "bi")
Font.set = function (font, size, flagStr)
-- Different OSes use different font sizes, for some reason
-- This should give a similar size on Mac/Linux as on Windows
if not string.match( reaper.GetOS(), "Win") then
size = math.floor(size * 0.8)
end
-- Cheers to Justin and Schwa for this
local flags = 0
if flagStr then
for i = 1, flagStr:len() do
flags = flags * 256 + string.byte(flagStr, i)
end
end
gfx.setfont(1, font, size, flags)
end
|
I would guess that the OS is not detectable for JSFX?
__________________
______ Announcing__mrelwood plugins______
.. MacBook Pro 16" Late '19 .. Scarlett 6i6, Saffire Pro 24 DSP (+ADA8000) .. FCA610 .. EVE SC207 .. Focal: Shape 65, Alpha 65, CMS 40, Listen Pro ..
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 03:33 AM.
|