I am trying to convert a Pango Font Description returned from a Font Chooser Dialog in GTK 3 to a string, however the C function:
pango_font_description_to_string()
Does not work, as it is a different language. I have scoured the web in search of an answer, however it has been fruitless. Does anyone have any idea of how to convert a Pango font description to a String?
Asked
Active
Viewed 644 times
0

user1150512
- 259
- 1
- 9
-
1What do you mean by "different language"? What happens if you use .to_string() ? – Ancurio Sep 22 '12 at 15:40
-
What I meant was that C and Vala are different, so the function did not work. .to_string() did, thanks. – user1150512 Sep 22 '12 at 15:42
-
Sorry to bug you, but would you happen to know how to convert from string to Font Description? – user1150512 Sep 22 '12 at 15:44
-
You do know how Vala name mangling works, right? whenever there is a C function a la "some_object_function()", in Vala, it becomes SomeObject.function(). That's why I was able to find your function even though I never used Pango. – Ancurio Sep 22 '12 at 15:44
-
I only started to learn vala yesterday, so thanks for the pointer. – user1150512 Sep 22 '12 at 15:51
-
Are you working your way through the official Gnome tutorial as well as some easy GTK samples? – Ancurio Sep 22 '12 at 15:54
-
Yep, and I looked at one that had to do with Opening a file and making something to view it, and thought about making it so it can change the font, and then to store the font in GSettings. – user1150512 Sep 22 '12 at 15:57
1 Answers
1
The documentation should have everything you need to know.
For getting the string representation, it is my_description.to_string()
, for the reverse (description from string), it should be
var my_description = FontDescription.from_string("Description");

Ancurio
- 1,698
- 1
- 17
- 32