How do I change the font of a RichText?
[lua]
local MenuPanel = vgui.Create( "DFrame" )
MenuPanel:SetSize( ScrW()*0.75, ScrH()*0.75 )
MenuPanel:Center()
MenuPanel:SetTitle( "" )
MenuPanel:SetVisible( false )
MenuPanel:SetDraggable( true )
MenuPanel:ShowCloseButton( true )
MenuPanel:SetDeleteOnClose( false )
MenuPanel:MakePopup()
MenuPanel.OnClose = function()
local Panel = vgui.Create( "DPanel", MenuPanel )
Panel:SetSize( MenuPanel:GetWide()-10*2, MenuPanel:GetTall()-35*2 )
Panel:SetPos( 5, 30 )
Panel.Paint = function()
surface.SetDrawColor( 255, 255, 255, 125 )
surface.DrawRect( 0, 0, Panel:GetWide(), Panel:GetTall() )
end
local RText = vgui.Create( "RichText" , Panel )
RText:SetPos( 0, 0 )
RText:SetSize(Panel:GetWide()-5, Panel:GetTall() - 35)
RText.Paint = function()
surface.SetDrawColor( 255, 255, 255, 125 )
surface.DrawRect( 0, 0, RText:GetWide()-20, RText:GetTall() )
surface.SetDrawColor( 125, 125, 125, 125 )
surface.DrawRect( RText:GetWide()-20, 0, 20, RText:GetTall() )
end
[/lua]
Have you tried using RText:SetFont?
[lua]
RText:SetFont("ChatFont")
[/lua]
[code]
[ERROR] lua/autorun/custompm.lua:209: attempt to call method 'SetFont' (a nil value)
[/code]
Doesn't appear to be possible from everything I've tried.
[QUOTE=Lerpaderp;39997943]Doesn't appear to be possible from everything I've tried.[/QUOTE]
:/ thought that might be the case.
I've been researching on this a while ago. It turns out nothing works, not even SetInternalFont.
You'd be better off writing your own replacement with fonts and stuff instead of trying to use RichText.
[QUOTE=typedef state;39998539]I've been researching on this a while ago. It turns out nothing works, not even SetInternalFont.
You'd be better off writing your own replacement with fonts and stuff instead of trying to use RichText.[/QUOTE]
Surely there must be a work around, maybe manually creating each letter within the paint function?