|
@@ -103,27 +103,29 @@ public class FontResource
|
|
|
SJSON.save(material, project.absolute_path(resource_name) + ".material");
|
|
SJSON.save(material, project.absolute_path(resource_name) + ".material");
|
|
|
|
|
|
|
|
// Generate .font resource.
|
|
// Generate .font resource.
|
|
|
- var glyphs = new Gee.ArrayList<Value?>();
|
|
|
|
|
|
|
+ Guid font_id = Guid.new_guid();
|
|
|
|
|
+ db.create(font_id, OBJECT_TYPE_FONT);
|
|
|
|
|
+ db.set_property_double(font_id, "size", size);
|
|
|
|
|
+ db.set_property_double(font_id, "font_size", font_size);
|
|
|
|
|
+
|
|
|
for (int ii = 0; ii < dlg._font_range_max.value - dlg._font_range_min.value + 1; ++ii) {
|
|
for (int ii = 0; ii < dlg._font_range_max.value - dlg._font_range_min.value + 1; ++ii) {
|
|
|
GlyphData* gd = dlg.glyph_data(ii);
|
|
GlyphData* gd = dlg.glyph_data(ii);
|
|
|
|
|
|
|
|
- Hashtable glyph = new Hashtable();
|
|
|
|
|
- glyph["id"] = gd->id;
|
|
|
|
|
- glyph["x"] = gd->x;
|
|
|
|
|
- glyph["y"] = gd->y;
|
|
|
|
|
- glyph["width"] = gd->width;
|
|
|
|
|
- glyph["height"] = gd->height;
|
|
|
|
|
- glyph["x_offset"] = gd->x_offset;
|
|
|
|
|
- glyph["y_offset"] = gd->y_offset;
|
|
|
|
|
- glyph["x_advance"] = gd->x_advance;
|
|
|
|
|
- glyphs.add(glyph);
|
|
|
|
|
|
|
+ Guid glyph_id = Guid.new_guid();
|
|
|
|
|
+ db.create(glyph_id, "font_glyph");
|
|
|
|
|
+ db.set_property_double(glyph_id, "cp", gd->id);
|
|
|
|
|
+ db.set_property_double(glyph_id, "x", gd->x);
|
|
|
|
|
+ db.set_property_double(glyph_id, "y", gd->y);
|
|
|
|
|
+ db.set_property_double(glyph_id, "width", gd->width);
|
|
|
|
|
+ db.set_property_double(glyph_id, "height", gd->height);
|
|
|
|
|
+ db.set_property_double(glyph_id, "x_offset", gd->x_offset);
|
|
|
|
|
+ db.set_property_double(glyph_id, "y_offset", gd->y_offset);
|
|
|
|
|
+ db.set_property_double(glyph_id, "x_advance", gd->x_advance);
|
|
|
|
|
+
|
|
|
|
|
+ db.add_to_set(font_id, "glyphs", glyph_id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Hashtable font = new Hashtable();
|
|
|
|
|
- font["size"] = size;
|
|
|
|
|
- font["font_size"] = font_size;
|
|
|
|
|
- font["glyphs"] = glyphs;
|
|
|
|
|
- SJSON.save(font, project.absolute_path(resource_name) + ".font");
|
|
|
|
|
|
|
+ db.save(project.absolute_path(resource_name) + ".font", font_id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
dlg.destroy();
|
|
dlg.destroy();
|