karaoke-dev / osu-framework-font Goto Github PK
View Code? Open in Web Editor NEWUnofficial support for extra font effect.
License: MIT License
Unofficial support for extra font effect.
License: MIT License
Because karaoke text(or lyric text) is based on SpriteText, which will cause error after sprite text support localization
The main solution might create it's own sprite text, not use exist one.
Fix ruby/romaji not in the text center.
Separate issue #159
Because it might only have single shader in the karaoke project, so it should be OK to use SingleShaderBufferedDrawNode
as default in the karaoke sprite text and lyric sprite text.
Also, it can solve the FrameBuffer
recycle issue.
https://youtu.be/pWcRg7PnedE?t=97
Some karaoke software might have those behaviors.
Fix the case that might let position text cannot get the position:
How to fix that:
GetFixedPositionText
into PositionTextFormatter
.GetFixedPositionTexts
should only fix the duplicated value and move it inside applyPositionTextToBuilder
.Where to add the test:
TestSceneLyricSpriteTextCharacterPosition
-> rename is required
something like this
should be able to have those properties:
Sync some setting from osu-framework
.
Also remember to change license header to MIT license.
lowp vec4 outline(sampler2D tex, int radius, mediump vec2 texCoord, mediump vec2 texSize, mediump vec4 colour)
{
float angle = 0.0;
float outlineAlpha = 0.0;
for (int i = 0; i < SAMPLES; i++)
{
angle += 1.0 / (float(SAMPLES) / 2.0) * PI;
// todo: might need to adjust step samples amount to fill the inner side.
// but it will cause lots of performance issue if make step samples larger.
// so should find a better algorithm to fill inner colour.
for (int j = 1; j <= STEP_SAMPLES; j++)
{
vec2 testPoint = texCoord - vec2(sin(angle), cos(angle)) * (float(radius) * (1.0 / j)) / texSize;
float sampledAlpha = texture2D(tex, testPoint).a;
outlineAlpha = max(outlineAlpha, sampledAlpha);
}
}
mediump vec4 ogCol = texture2D(tex, texCoord);
vec4 outlineCol = mix(vec4(0.0), colour, outlineAlpha);
return mix(outlineCol, ogCol, ogCol.a);
}
Here's the shader and it can see that sin(angle), cos(angle))
runs lots of time on every frame (maybe run draw_width
* draw_height
* SAMPLES(2)
* STEP_SAMPLES(128)
times in each frame)
Maybe it can be calculated at the beginning.
Not really sure has someting like void init(void)
before void main(void)
and only run one time.
What's should be clean-up:
g_size
or m_size
.Those things might need shader support:
also notice that should be able to support multi shader eventually.
See how https://github.com/karaoke-dev/karaoke works.
Should be able to make lots of (or customize) blur effect, and is able to apply multi with order on sprite text.
Also should has flag to mark this effect is for:
Inspired from #182
Because more and more functions will be use in this repo.
So not really sure will it be suitable to move the function into here?
It's the root cause of karaoke-dev/karaoke#1318
We use IReadOnlyDictionary<TextIndex, double> TimeTags
for passing the time-tags to the karaoke sprite text.
But the transform will need to sort by time.
.
So the interface might be IReadOnlyDictionary<double, TextIndex>
TimeTags or IReadOnlyList<TimeTag>
Maybe the first one might be better because it will prevent the duplicated time.
Follow the issue in the karaoke-dev/karaoke#1318
All exist shader:
Also need to check:
Because should not be possible to let the lyric crash.
Also for supporting some cool effect(like reversing).
So there's no need to sort by time and index, should just need to sort by time. in the RefreshStateTransforms
.
Error:
osu.Framework.Graphics.Shaders.Shader+PartCompilationFailedException: A osu.Framework.Graphics.Shaders.ShaderPart failed to compile: sh_CRT.fs:
ERROR: 0:58: 'f' : syntax error: syntax error
at osu.Framework.Graphics.Shaders.ShaderPart.Compile()
at osu.Framework.Graphics.Shaders.Shader.CompileInternal()
at osu.Framework.Graphics.Shaders.Shader.compile()
at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal()
at osu.Framework.Threading.ScheduledDelegate.RunTask()
at osu.Framework.Graphics.OpenGL.GLWrapper.Reset(Vector2 size)
at osu.Framework.Platform.GameHost.DrawFrame()
at osu.Framework.Threading.GameThread.processFrame()
--- End of stack trace from previous location ---
at osu.Framework.Platform.GameHost.<>c__DisplayClass120_0.<abortExecutionFromException>b__0()
at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal()
at osu.Framework.Threading.Scheduler.Update()
at osu.Framework.Threading.GameThread.processFrame()
at osu.Framework.Threading.GameThread.RunSingleFrame()
at osu.Framework.Platform.ThreadRunner.RunMainLoop()
at osu.Framework.Platform.GameHost.windowUpdate()
at osu.Framework.Platform.SDL2DesktopWindow.Run()
at osu.Framework.Platform.GameHost.Run(Game game)
at osu.Framework.Font.Tests.Program.Main(String[] args) in /Volumes/Data/Github/karaoke-dev/osu-framework-font/osu.Framework.Font.Tests/Program.cs:line 21
It might by caused by "compile error", not "file not found"
karaoke-dev/karaoke#1312
This issue should be fixed in the framework.
Might be able to affect every character position like the image
See mixed texture deleted before, not really sure will be implemented by shader ๐ค
https://github.com/karaoke-dev/osu-framework-font/blob/2021.0708.0/osu.Framework.Font/Graphics/Sprites/ILyricTexture.cs
What's should be modified after #45 merged:
Notice that not deal with this issue before.
Because already filter the duplicated time-tag in the karaoke project.
Inspired from #157
Because still have some spacing in the first lyric's left side if contains draw extra spacing.
So should add delta with that.
We should deal with those extra sizing.
Sometimes ruby/romaji not change after set value.
Able to apply extra texture in fonts.
Because:
TextBuilderGlyph
.TextBuilder
.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.
Remain issue in the #157
Found in the karaoke-dev/karaoke#1293
Should re-calculate the transforms if change the shader in the karaoke sprite text.
Should not show the yellow area.
.
What's should be fixed:
IHasExtraSize
or IAffectRelativePosition
to let KaraokeSpriteText
able to adjust the position.'OutlineShader
only. Maybe will added in the StepShader
also(for able to sum the outline)Also, should write a test scene:
TestSceneKaraokeSpriteTextWithTimeTags
Inspired from #157
Should make something like the image below:
If not add the end time-tag before the next time-tag, will let the lyric effect moving faster because moving position will include that spacing.
This issue might be noticed if the character spacing become larger.
How to implement:
As title, missing the calculation in the KaraokeSpriteText
protected override Quad ComputeScreenSpaceDrawQuad()
{
// make draw size become bigger (for not masking the shader).
var newRectangle = DrawRectangle.Scale(2);
return ToScreenSpace(newRectangle);
}
It should be the union value of:
Found in karaoke-dev/karaoke#339
Need to make a fix.
In this demo implemented in the #172
It's easy to show that border size is not same as what render result is.
It's caused because osu!framework is not pixel perfect framework.
Means size 10 is not means 10 pixel in the screen.
So there's two way to fix that.
ComputeCharacterDrawRectangle
. here's the sample to get the size matching to the render size: originalCharacterDrawRectangle.Inflate(Math.Max(Radius * 88f / 256f, 0));
What's needed in this issue:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.