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

hb_face_create() with an empty blob #1572

Open
khaledhosny opened this issue Feb 7, 2019 · 2 comments

Comments

@khaledhosny
Copy link
Collaborator

commented Feb 7, 2019

I was expecting the code below to print 1, but it prints 0; even though hb_face_create() is essentially returning an empty face, it is still not equal to hb_face_get_empty (). Is this expected?

#include <stdio.h>
#include <hb.h>

int
main (int argc, char** argv)
{
  printf("%d\n", hb_face_create (hb_blob_get_empty (), 0) == hb_face_get_empty ());
}
@behdad

This comment has been minimized.

Copy link
Member

commented Feb 8, 2019

It used to be that way, but I changed it, because, a face created using an empty blob can still be meaningfully used for certain tasks. The hb-fc-list does that I think. Whereas if we returned the empty face then it would be inert and refuse shaping with it.

I can't make up my mind, maybe creating a blob for zero bytes should also return a new instance instead of returning the nil instance.

@khaledhosny

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 9, 2019

For my case, I was trying to catch for faces created from non-existing file. But I think what I actually need is a general check “is this an SFNT font” since that what I care about, and checking for table tags might be a more robust check for my specific case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.