C# Класс QuickFont.QFontRenderOptions

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
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

Открытые методы

Метод Описание
CreateClone ( ) : QFontRenderOptions

Описание методов

CreateClone() публичный Метод

public CreateClone ( ) : QFontRenderOptions
Результат QFontRenderOptions

Описание свойств

CharacterSpacing публичное свойство

Spacing between characters in units of average glyph width
public float CharacterSpacing
Результат float

Colour публичное свойство

The font colour
public Color Colour
Результат Color

DropShadowActive публичное свойство

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
Результат bool

DropShadowOffset публичное свойство

Offset of the shadow from the font glyphs in units of average glyph width
public Vector2,System DropShadowOffset
Результат System.Vector2

DropShadowOpacity публичное свойство

Opacity of drop shadows
public float DropShadowOpacity
Результат float

JustifyCapContract публичное свойство

Total justification cap as a fraction of the boundary width.
public float JustifyCapContract
Результат float

JustifyCapExpand публичное свойство

Total justification cap as a fraction of the boundary width.
public float JustifyCapExpand
Результат float

JustifyContractionPenalty публичное свойство

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
Результат float

LineSpacing публичное свойство

Line spacing in units of max glyph width
public float LineSpacing
Результат float

LockToPixel публичное свойство

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
Результат bool

LockToPixelRatio публичное свойство

Only applies when LockToPixel is true: This is used to transition smoothly between being locked to pixels and not
public float LockToPixelRatio
Результат float

Monospacing публичное свойство

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
Результат QFontMonospacing

TransformToViewport публичное свойство

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
Результат TransformViewport?

UseDefaultBlendFunction публичное свойство

Whether to always set : GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.DstAlpha); before rendering text.
public bool UseDefaultBlendFunction
Результат bool

WordSpacing публичное свойство

Spacing between words in units of average glyph width
public float WordSpacing
Результат float

WordWrap публичное свойство

Wrap word to next line if max width hit
public bool WordWrap
Результат bool