Comments (26)
Wait do you mean it returns x_advance only?
from vkvg.
Yes, it would be a good idea to return the same values from vkvg_get_glyph_position
regardless of the backend vkvg uses.
from vkvg.
Oh right, that was so easy I didn't think about it...
from vkvg.
Right, thank you, I also changed the x_advance
type at line 29 to int32_t
. Now I get:
Text x_advance = 184.000000
...
Total x_advance = 12083
which still are not the same.
from vkvg.
Don't worry! I was just exaggerating.
from vkvg.
and? hb return x_advance, that looks normal for me.
metrics looks different between with/without harfbuzz.
from vkvg.
But if that's normal, what should you do with this info? I mean, it's the same for all glyphs.
from vkvg.
Oh ok, but isn't 1024 too much? The glyphs are clearly not distant 1024 pixels from each other.
from vkvg.
Font metrics has some subtilities, we have to define clearly what unit we use for both harfbuzz and stb for returned values.
from vkvg.
I noticed that with or without HarfBuzz I always get 1024, 0, 0, 0.
from vkvg.
I made a quick test this afternoon, and I got different results, I have to double check this.
from vkvg.
@billzez do you have the same issue?
from vkvg.
I believe these values are fixed point, so you have to convert to float. (float)x_advance / 16.0
for subpixel position or just x_advance >> 6
.
from vkvg.
Thanks, but why divide by 16? Also, comparing the result of vkvg_text_run_get_glyph_position
with the one from vkvg_text_run_get_extents
, with a text run of only one character, on the former I get sane values, like width = 16
, height = 36
, x_advance = 16
, y_advance = 0
, while on the latter I still get 1024, 0, 0, 0, 0
. Even if I divide 2014 by 16, I get 64, which is four times greater than the text run x_advance
.
from vkvg.
give me a complete run-able sample so that I could check everything.
from vkvg.
Here you go: https://gitlab.com/Rubo/shitty. The relevant function is here: https://gitlab.com/Rubo/shitty/-/blob/master/editor/main.c#L42
from vkvg.
I run 'make', and nothing happens. I was talking about a simple unit test, you may just add a method or two in the tests/text.c sample, this would be simpler for me.
from vkvg.
I think this would suffice: hello.txt (I changed its extension to .txt
so that GitHub would not complain).
As a result, with HarfBuzz I get:
Text x_advance = 184.000000
Glyphs x_advance:
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
Total x_advance = 12083.000000
from vkvg.
my result with harfbuzz & freetype:
Text x_advance = 196.000000
Glyphs x_advance:
196.000000
196.000000
196.000000
196.000000
196.000000
196.000000
196.000000
196.000000
196.000000
196.000000
196.000000
196.000000
196.000000
Total x_advance = 12953.000000
from vkvg.
and without harfbuzz, small metrics diff:
Text x_advance = 203.000000
Glyphs x_advance:
203.000000
203.000000
203.000000
203.000000
203.000000
203.000000
203.000000
203.000000
203.000000
203.000000
203.000000
203.000000
203.000000
Total x_advance = 12992.000000
from vkvg.
change
printf("%f\n", info.x_advance);
with
printf("%d\n", info.x_advance);
It's an integer, that you try to print out as a float....
from vkvg.
How old are you Rubo?
from vkvg.
Does it matter?
from vkvg.
Sometimes I feel you are very young (12-14yo), but maybe I'm wrong. I appreciate your involvement but you have to solve such simple issue by yourself. Creating opensource software is such demanding, you must be a little harder with yourself. Other pr are really complicated, there I'm pleased to help you, but here, you should be able to go forward by yourself. Tanks again for your help.
from vkvg.
Sometimes I feel you are very young (12-14yo)
Well this one did hurt...
Anyway, I solved by creating a text run for each glyph, then vkvg_text_extents_t.width
and vkvg_text_extents_t.height
did the trick. Sorry to have bothered you with such simple issues.
from vkvg.
I didn't mean to hurt you, sorry.
from vkvg.
Related Issues (20)
- gradient alpha channel ignored HOT 2
- Segfaults in surface test HOT 1
- Build deb for Debian / Ubuntu HOT 2
- Premult Alpha handling for image load/write
- Special objects with VKVG_STATUS_NO_MEMORY instead of NULL pointer.
- TimeLine semaphore HOT 2
- Implementing Unit Testing with Meson
- Tests crash and other related bugs and Validation errors: HOT 11
- Having trouble using vkh.h HOT 1
- M_PI undeclared HOT 2
- tests/bezier screen not clear on each frame HOT 3
- Cannot build tests on linux with static GLFW HOT 3
- Multi-window support? HOT 3
- crash when i use multithreaded to draw text HOT 5
- i want to remove the font lock HOT 1
- Vulkan validator prints error on fragment compilation (vkCreateShaderModule) HOT 8
- Failed to build on MSYS2 MINGW64 HOT 3
- logicOp not supported on MoltenVK / M2 Mini HOT 3
- vkvg api to query vulkan context creation requirements
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vkvg.