ravi.joshi53's picture

Unable to Flip the QuickFont

Hi,
I have an orthogonal view (which is flipped 180 degree) containing some text written using QuickFont
I wanted to flip the text so I thought of setting QFontBuilderConfiguration.TransformToCurrentOrthogProjection and TransformViewport for QFontRenderOptions but its not working. Below is the snippet of my code-

        const float LeftX = 0.0f;
        const float RightX = 16.0f;
        const float BottomY = 12.0f;
        const float TopY = 0.0f;
        const float FarZ = 1.0f;
        const float NearZ = -1.0f;
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            QFontBuilderConfiguration fontBuilderConfiguration = new QFontBuilderConfiguration();
            fontBuilderConfiguration.TransformToCurrentOrthogProjection = true; // Adding this throwing error
            font = new QFont("Fonts/HappySans.ttf", 30, fontBuilderConfiguration);
            QFontRenderOptions fontRenderOptions = new QFontRenderOptions();
            fontRenderOptions.TransformToViewport = new TransformViewport(0, 0, RightX, BottomY);
            font.PushOptions(fontRenderOptions);
            GL.ClearColor(Color.AliceBlue);
            GL.Disable(EnableCap.DepthTest);
        }
 
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            GL.Viewport(0, 0, Width, Height);
            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadIdentity();
            GL.Ortho(RightX, LeftX, TopY, BottomY, FarZ, NearZ);
        }

And what I want is this -
flipped (Both Horizontally and Vertically) Text

I tried to remove fontBuilderConfiguration.TransformToCurrentOrthogProjection but it doesn't work.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ravi.joshi53's picture

Ohhhh....... I got it now.... thank you for the detailed answer.