Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement font outline. #3

Closed
andy840119 opened this issue Jun 28, 2020 · 10 comments
Closed

Implement font outline. #3

andy840119 opened this issue Jun 28, 2020 · 10 comments

Comments

@andy840119
Copy link
Member

andy840119 commented Jun 28, 2020

The safety way is to calculate outline texture, not in render.
See how this demo works.
.
Edit :
oops this demo seems cannot use because it's slow and not perfect.
image

@andy840119
Copy link
Member Author

Or this demo.
Only see OpenGL Demo because other project is written for other framework.

@andy840119
Copy link
Member Author

andy840119 commented Jun 28, 2020

Or using image sharp to draw text?
SixLabors/ImageSharp#407
See the example here, might install SixLabors.Fonts(in prelease).

@andy840119
Copy link
Member Author

andy840119 commented Jul 2, 2020

Sample code has been created.
Need to calculate the time it spend.

Edit:
ImageSharp cost too much time 😢

@andy840119
Copy link
Member Author

http://geoffprewett.com/blog/software/opengl-outline/
Maybe it's better add .fs file and deal with outline effect.

@andy840119
Copy link
Member Author

andy840119 commented Jul 11, 2020

Or trying https://gist.github.com/xoppa/33589b7d5805205f8f08
.
Note :
can search openGL texture outline GLSL to get more relative info.
And this sample is just for testing.

@andy840119
Copy link
Member Author

andy840119 commented Jul 11, 2020

Writing GLSL in vscode :
https://www.youtube.com/watch?v=WNcczXF4hSY
.
Install Shader languages support for vscode and glsl canvas in vscode.

@andy840119
Copy link
Member Author

andy840119 commented Jul 17, 2020

Run this project and check is it workable with text.
Run this project and try to change texture, change outline size and color first.
.
Edit :
image
Not working perfect 😢

@andy840119
Copy link
Member Author

andy840119 commented Oct 29, 2020

Running this code :

new SpriteText
{
    Text = "Outlined Text",
    Font = new FontUsage(size: 72),
}.WithEffect(new OutlineEffect
{
    BlurSigma = new Vector2(3f),
    Strength = 100f,
    Colour = Color4.Blue,
    PadExtent = true,
}),

Can have this effect :
image
.
Maybe create IEffect like KaraokeSolidOutlineEffect and try to loading them like :

Child = InitializeEffect?.invoke(x => {
   //...
});

Then like
karaokeText.InitializeEffect = (x) => {
x.WithEffect(KaraokeSolidOutlineEffect){
// Parameter
}
}
in DrawableLyric

@andy840119
Copy link
Member Author

Also need to test about accept multi outline effect at the same time?

@andy840119
Copy link
Member Author

andy840119 commented Oct 4, 2021

Implemented in #43 using shader.
Finally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant