Old 02-04-2015, 02:06 PM   #1
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default print unicode music symbols with lua

How does one output Unicode symbols with Lua inside Reaper?

Thanks
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)

Last edited by reddiesel41264; 02-06-2015 at 09:20 AM.
reddiesel41264 is offline   Reply With Quote
Old 02-06-2015, 09:20 AM   #2
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default

I'm giving this post a little bump and I also want to ask is it possible to use external Lua libraries inside Reaper?
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)
reddiesel41264 is offline   Reply With Quote
Old 02-08-2015, 09:14 AM   #3
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default

For those interested I figured out a couple of ways to print Unicode characters. You have to use a hex notation or use the utf8 library.

The two links below showed me the way
http://www.lua.org/manual/5.3/manual...utf8.codepoint
http://lua.2524044.n2.nabble.com/Uni...td7056298.html

I also found this useful tool for converting between "U+EA03" style notation and hex and decimal.
http://www.ltg.ed.ac.uk/~richard/utf...=E0A0&mode=hex
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)
reddiesel41264 is offline   Reply With Quote
Old 02-08-2015, 04:12 PM   #4
Lazarus
Human being with feelings
 
Join Date: Aug 2013
Posts: 1,355
Default

Thanks for posting your findings in the absence of any replies.
Lazarus is offline   Reply With Quote
Old 02-08-2015, 07:49 PM   #5
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,812
Default

To draw U+EA03 for example, you can use reaper.drawchar(0xEA03), which will do the unicode conversion internally. Also, reaper.measurechar(0xEA03) will give you the dimensions of the character in the currently selected font.
schwa is offline   Reply With Quote
Old 02-09-2015, 01:48 AM   #6
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default

Ah, that's much better. Thank you!
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)
reddiesel41264 is offline   Reply With Quote
Old 02-09-2015, 03:35 PM   #7
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default

I got an error with reaper.drawchar but gfx.drawchar worked
Any news on the includes, I keep getting messages that Reaper can't find the files, I'm using things like require "myluafile". And should it also work with .h files?
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)

Last edited by reddiesel41264; 02-09-2015 at 04:09 PM.
reddiesel41264 is offline   Reply With Quote
Old 02-09-2015, 05:29 PM   #8
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,812
Default

Right, gfx.drawchar.

require and dofile should work. If the files aren't being found, it's probably a path problem. Remember that lua paths are wildcard patterns, not just directory listings.

http://www.lua.org/pil/8.1.html
schwa is offline   Reply With Quote
Old 02-10-2015, 12:20 AM   #9
reddiesel41264
Human being with feelings
 
reddiesel41264's Avatar
 
Join Date: Jan 2012
Location: North East UK
Posts: 493
Default thanks

Cool, thank you
__________________
http://librewave.com - Freedom respecting instruments and effects
http://xtant-audio.com/ - Purveyor of fine sample libraries (and Kontakt scripting tutorials)
reddiesel41264 is offline   Reply With Quote
Old 08-30-2020, 01:08 AM   #10
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Quote:
Originally Posted by schwa View Post
To draw U+EA03 for example, you can use reaper.drawchar(0xEA03), which will do the unicode conversion internally.
reaper.drawchar(0xEA03) draws an empty rectangle here and not the correct character

gfx.drawchar(0x1D15D) does not draw anything, while it should draw a whole note (at least with Reavura). Any ideas?

BTW, is this supported? :
Code:
gfx.setfont(1,"Reavura", 60)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 08-30-2020 at 01:15 AM.
amagalma is offline   Reply With Quote
Old 08-30-2020, 08:20 AM   #11
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,629
Default

I can confirm, that it seems to use Arial on Windows instead...

At least it looks identical...

Code:
gfx.init("")

gfx.setfont(1,"Times", 60)
gfx.drawchar(65)
gfx.setfont(1,"Arial", 60)
gfx.drawchar(65)
gfx.setfont(1,"Reavura", 60)
gfx.drawchar(65)


tested on Windows 7, Reaper 6.11.

In general, some fonts seem not being supported. I noticed, that you can't use all installed fonts in video-processor as well, only a handful.

Edit:
Yes, it seems like it can't find the font and uses Arial as default instead, like the following example loads the exact same font.
Code:
gfx.setfont(1,"", 60)
gfx.drawchar(65)
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 08-30-2020 at 08:31 AM.
Meo-Ada Mespotine is online now   Reply With Quote
Old 08-30-2020, 03:35 PM   #12
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Thanks for testing mespotine!

It would be nice if at least Reavura was supported.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 09-03-2020, 02:49 AM   #13
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

FR for Reavura support
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma 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 04:12 AM.


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