|
|
|
11-30-2022, 09:18 PM
|
#1
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 662
|
reaper. ShowConsoleMsg font
reaper. ShowConsoleMsg
Can the display font in this function be adjusted?
I can't remember which version started, and the Chinese fonts in this window are particularly ugly.
|
|
|
12-01-2022, 08:31 AM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Yes it's possible to change the font. However, it must be set every time the console opens.
And you always have to try out, which of the supported fonts to use.
It's not possible to have a script that always sets the same font, but multiple scripts that set one font and it changes, which script represents which font this time.
It's a Reaper limitation...
And there are just 10 or so different fonts available.
|
|
|
12-01-2022, 05:51 PM
|
#3
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 662
|
Thank you for your reply. Which API is used to set fonts?
|
|
|
12-02-2022, 04:08 AM
|
#4
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Here's a function I wrote some time ago. The parameter "style" must be between 1 and 17.
I couldn't get the individual style become stable, means, sometimes style=1 was bold, later it was italic, later it was underlined, etc.
So I could only nail the individual styles to 19 different ones but what each style means, changes.
So you need to check this probably with every new Reaper start...
Code:
function SetReaScriptConsole_FontStyle(style)
-- parameter style must be between 1 and 19
local translation = reaper.JS_Localize("ReaScript console output", "DLG_437")
local reascript_console_hwnd = reaper.JS_Window_Find(translation, true)
if reascript_console_hwnd==nil then return false end
local styles={32,33,36,31,214,37,218,1606,4373,3297,220,3492,3733,3594,35,1890,2878,3265,4392}
local Textfield=reaper.JS_Window_FindChildByID(reascript_console_hwnd, 1177)
reaper.JS_WindowMessage_Send(Textfield, "WM_SETFONT", styles[style] ,0,0,0)
end
SetReaScriptConsole_FontStyle(2)
Hope, one of the styles renders chines better...
|
|
|
12-02-2022, 08:59 AM
|
#5
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 662
|
Thanks for your help. Running this function after opening the Console does not automatically refresh to a new font. I must click on the window to change it.
In addition,Can I set the font size?
|
|
|
12-02-2022, 09:22 AM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Nope. These 19 options are all you have currently.
|
|
|
12-02-2022, 02:09 PM
|
#7
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Quote:
Originally Posted by Meo-Ada Mespotine
Here's a function I wrote some time ago.
|
Cool trick! I always wanted to make the text in the console a bit easier to see!
EDIT, Updated my Msg function, note I set lparam to 1 (make it redraw) otherwise font wasn't set on very first usage.
Code:
function msg(str)
reaper.ShowConsoleMsg(tostring(str) .. '\n') -- show msg
local hwnd = reaper.JS_Window_FindTop("ReaScript console output", true) -- get console window
if hwnd then
reaper.JS_WindowMessage_Send(reaper.JS_Window_FindChildByID(hwnd, 1177), "WM_SETFONT", 32, 0, 1, 0) -- set font bolder then normal
reaper.JS_Window_Show(hwnd, "SHOWNA") -- bring console to front but do not focus
end
end
Last edited by Edgemeal; 12-02-2022 at 02:30 PM.
|
|
|
12-02-2022, 02:32 PM
|
#8
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Does the font stay the same in your function after every restart of Reaper? That was the reason I never released it with Ultraschall-Api.
|
|
|
12-02-2022, 02:50 PM
|
#9
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Quote:
Originally Posted by Meo-Ada Mespotine
Does the font stay the same in your function after every restart of Reaper? That was the reason I never released it with Ultraschall-Api.
|
Restarted like a dozen times and seems OK, but I'm also just restarting REAPER and running a test script (using the msg function above), and not really doing much of anything else, but so far so good. I'll report back if it doesn't.
|
|
|
12-02-2022, 03:14 PM
|
#10
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
I'm guessing this will work for most any 'Edit' class window, So tried it on the media item Source Properties window, works there as well.
I'm calling WavInfoFont() from a defer loop...
Code:
function SetFont(hwnd, childId)
reaper.JS_WindowMessage_Send(reaper.JS_Window_FindChildByID(hwnd, childId), "WM_SETFONT", 32, 0, 1, 0)
end
local prev_WAV_info
function WavInfoFont()
local hwnd = reaper.JS_Window_FindTop(".WAV file info" ,true)
if hwnd and (prev_WAV_info ~= hwnd) then
prev_WAV_info = hwnd
SetFont(hwnd, 0x40E)
end
end
|
|
|
12-02-2022, 03:17 PM
|
#11
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Hmm, I hope it stays like this. Would love to finally release the function after 2 years of it being in limbo XD
I think, maybe the dev's change of the font to monospace could have made it more stable...
Have never tried it on other dialogs before
|
|
|
12-02-2022, 09:01 PM
|
#12
|
Human being with feelings
Join Date: Jan 2019
Location: China
Posts: 662
|
Thank yous for yours help. Now the font can be displayed correctly, and the display is very clear! That is great!
|
|
|
12-02-2022, 10:42 PM
|
#13
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
|
Quote:
Originally Posted by Meo-Ada Mespotine
Hmm, I hope it stays like this. Would love to finally release the function after 2 years of it being in limbo XD
I think, maybe the dev's change of the font to monospace could have made it more stable...
Have never tried it on other dialogs before
|
I don't get how this even works, MSDN says wParam is supposed to be a handle to a font. I'm simply setting it to 32 and getting bold text.
Seems OK though, I don't see any leaks of reaper.exe in Win10, handle count, memory usage and GDI count all seem stable.
|
|
|
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 11:01 PM.
|