Old 11-30-2022, 09:18 PM   #1
dangguidan
Human being with feelings
 
Join Date: Jan 2019
Location: China
Posts: 662
Default 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.
Attached Images
File Type: jpg before.jpg (11.2 KB, 63 views)
File Type: jpg now.jpg (11.2 KB, 61 views)
dangguidan is offline   Reply With Quote
Old 12-01-2022, 08:31 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

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.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-01-2022, 05:51 PM   #3
dangguidan
Human being with feelings
 
Join Date: Jan 2019
Location: China
Posts: 662
Default

Thank you for your reply. Which API is used to set fonts?
dangguidan is offline   Reply With Quote
Old 12-02-2022, 04:08 AM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

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...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-02-2022, 08:59 AM   #5
dangguidan
Human being with feelings
 
Join Date: Jan 2019
Location: China
Posts: 662
Default

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?
dangguidan is offline   Reply With Quote
Old 12-02-2022, 09:22 AM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Nope. These 19 options are all you have currently.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-02-2022, 02:09 PM   #7
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
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.
Edgemeal is offline   Reply With Quote
Old 12-02-2022, 02:32 PM   #8
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

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.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-02-2022, 02:50 PM   #9
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
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.
Edgemeal is offline   Reply With Quote
Old 12-02-2022, 03:14 PM   #10
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

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
Edgemeal is offline   Reply With Quote
Old 12-02-2022, 03:17 PM   #11
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

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
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 12-02-2022, 09:01 PM   #12
dangguidan
Human being with feelings
 
Join Date: Jan 2019
Location: China
Posts: 662
Default

Thank yous for yours help. Now the font can be displayed correctly, and the display is very clear! That is great!
dangguidan is offline   Reply With Quote
Old 12-02-2022, 10:42 PM   #13
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
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.
Edgemeal 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 11:01 PM.


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