Garry's Mod Wiki


  Panel:SetFontInternal( string fontName )


Sets the font used to render this panel's text. This works for Label, TextEntry and RichText, but it's a better idea to use their local SetFont (DTextEntry:SetFont, DLabel:SetFont) methods when available.

To retrieve the font used by a panel, call Panel:GetFont.


1 string fontName
The name of the font.

See here for a list of existing fonts. Alternatively, use surface.CreateFont to create your own custom font.


Sets the font of a RichText element to match the chat box font.

-- Create a window frame local TextFrame = vgui.Create( "DFrame" ) TextFrame:SetSize( 300, 200 ) TextFrame:Center() TextFrame:SetTitle( "This is a font test" ) TextFrame:MakePopup() -- RichText panel local richtext = vgui.Create( "RichText", TextFrame ) richtext:Dock( FILL ) -- Sample text richtext:SetText( "This is a sample of text using the chat box font." ) -- Ensure font and text color changes are applied -- We have to wait until after the internals of RichText set the default font function richtext:PerformLayout() self:SetFontInternal( "ChatFont" ) self:SetFGColor( color_white ) end