C# Class QuickFont.QFontRenderOptions

Mostrar archivo Open project: swax/QuickFont Class Usage Examples

Public Properties

Property Type Description
CharacterSpacing float
Colour Color
DropShadowActive bool
DropShadowOffset System.Vector2
DropShadowOpacity float
JustifyCapContract float
JustifyCapExpand float
JustifyContractionPenalty float
LineSpacing float
LockToPixel bool
LockToPixelRatio float
Monospacing QFontMonospacing
TransformToViewport TransformViewport?
UseDefaultBlendFunction bool
WordSpacing float
WordWrap bool

Public Methods

Method Description
CreateClone ( ) : QFontRenderOptions

Method Details

CreateClone() public method

public CreateClone ( ) : QFontRenderOptions
return QFontRenderOptions

Property Details

CharacterSpacing public_oe property

Spacing between characters in units of average glyph width
public float CharacterSpacing
return float

Colour public_oe property

The font colour
public Color Colour
return Color

DropShadowActive public_oe property

Whether to draw a drop-shadow. Note: this requires the QFont to have been loaded with a drop shadow to take effect.
public bool DropShadowActive
return bool

DropShadowOffset public_oe property

Offset of the shadow from the font glyphs in units of average glyph width
public Vector2,System DropShadowOffset
return System.Vector2

DropShadowOpacity public_oe property

Opacity of drop shadows
public float DropShadowOpacity
return float

JustifyCapContract public_oe property

Total justification cap as a fraction of the boundary width.
public float JustifyCapContract
return float

JustifyCapExpand public_oe property

Total justification cap as a fraction of the boundary width.
public float JustifyCapExpand
return float

JustifyContractionPenalty public_oe property

By what factor justification is penalized for being negative. (e.g. if this is set to 3, then a contraction will only happen over an expansion if it is 3 of fewer times smaller than the expansion).
public float JustifyContractionPenalty
return float

LineSpacing public_oe property

Line spacing in units of max glyph width
public float LineSpacing
return float

LockToPixel public_oe property

Locks the position to a particular pixel, allowing the text to be rendered pixel-perfectly. You need to turn this off if you wish to move text around the screen smoothly by fractions of a pixel.
public bool LockToPixel
return bool

LockToPixelRatio public_oe property

Only applies when LockToPixel is true: This is used to transition smoothly between being locked to pixels and not
public float LockToPixelRatio
return float

Monospacing public_oe property

Whether to render the font in monospaced mode. If set to "Natural", then monospacing will be used if the font loaded font was detected to be monospaced.
public QFontMonospacing Monospacing
return QFontMonospacing

TransformToViewport public_oe property

This is intended as a means of rendering text pixel-perfectly at a fixed display size (size on screen) independent of the screen resolution. Ordinarily it is possible to render pixel-perfect text by calling QFont.Begin() / QFont.End(); however, this means working in a coordinate system corresponding to the current screen resolution. If the screen resolution changes, then the display size of the font will change accordingly which may not be desirable. Many games/applications prefer to use a fixed orthog coordinate system that is independent of screen resolution (e.g. 1000x1000) so that when the screen resolution changes, everything is still the same size on screen, it simply has higher definition - which is what this setting supports. One option is simply not to call QFont.Begin() / QFont.End(). This works; however, it becomes impossible to assure that glyphs are rendered pixel-perfectly. Instead they will be scaled in hardware. In most cases this looks fine; however, if you are a perfectionist, you may prefer to use this option to assure pixel perfection. Setting this option does two things: Rendering to a specified position is transformed Measurements are transformed So for example, suppose the screen resolution is 1024x768, but you wish to run orthog mode at 1000x1000. If you set: myFont.Options.TransformToViewport = new Viewport(0,0,1000,1000); Then, if you render at position 500,500: QFont.Begin(); myFont.Options.LockToPixel = true; myFont.Print("Hello",new Vector2(500,500)); QFont.End(); This will be printed pixel-pefectly at pixel position 512, 384. Additionally the font will be measured in terms of your 500x500 coordinate system. The only issue is that if you change the resolution, the size of your font will change. You can get around this by loading a font size that is proportional to the screen resolution. This makes sense: if you want a font to be rendered pixel-perfectly at a higher resolution, it will need to be a larger font. At present this needs to be doen manually. E.g: float fontScale = (float)Height / 800; compyFontSmall = new QFont("Data/comfy.ttf", 14 * fontScale);
public TransformViewport? TransformToViewport
return TransformViewport?

UseDefaultBlendFunction public_oe property

Whether to always set : GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.DstAlpha); before rendering text.
public bool UseDefaultBlendFunction
return bool

WordSpacing public_oe property

Spacing between words in units of average glyph width
public float WordSpacing
return float

WordWrap public_oe property

Wrap word to next line if max width hit
public bool WordWrap
return bool