dxGetFontHeight
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
This function retrieves the theoretical height of a certain piece of text, if it were to be drawn using dxDrawText.
Note
The returned height will be in logical units which are 1.75 times the actual pixel height.
Syntax
dxGetFontHeight ( )Code Examples
client
screenWidth, screenHeight = guiGetScreenSize() -- Get the screen resolutionscale = 2 -- The scale of both texts
-- We add an event handler to keep drawing the textaddEventHandler("onClientRender",root,function()
-- Draw the first text 400 pixels from the top and left of the screen dxDrawText("Hello!", 400, 400, screenWidth,screenHeight,tocolor(255,255,255,255),scale,"pricedown")
-- Draw the second text above the first one. -- The variable "offset" will return the height of the first text, so we can position the second text above the first one. -- If we changed the scale, the second text would still be above the first one, since we calculated the height of the font. offset = dxGetFontHeight(scale,"pricedown") dxDrawText("Hello!", 400, 400 - offset, screenWidth, screenHeight,tocolor(255,255,255,255),scale,"pricedown")end)See Also
Drawing Functions
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTarget
- dxCreateScreenSource
- dxCreateShader
- dxCreateTexture
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawModel3D
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsFormat
- dxGetPixelsSize
- dxGetStatus
- dxGetTextSize
- dxGetTexturePixels
- dxGetTextWidth
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetShaderValue
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource