diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-16 20:04:33 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-16 20:05:22 -0300 |
commit | 816b3fa94de91fb671b58d7cda57f10104a682da (patch) | |
tree | 49482dc65c688694dc05410aa104960e9d875f76 /tools/editor | |
parent | c4c6797fc1d700f59ea8d4927d42c1838bcfb3b9 (diff) |
It is now possible to set a default custom theme, whether you want a hidpi default theme, or just use a custom font for the default theme
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/io_plugins/editor_font_import_plugin.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index d5e6e3077e..2fbc4af94f 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -489,18 +489,22 @@ class EditorFontImportDialog : public ConfirmationDialog { Image img = tex->get_data(); f->store_line("static const int _builtin_font_img_width="+itos(img.get_width())+";"); - f->store_line("static const int _builtin_font_img_height="+itos(img.get_height())+";"); - f->store_line("static const unsigned char _builtin_font_img_data["+itos(img.get_width()*img.get_height()*2)+"]={"); - for(int i=0;i<img.get_height();i++) { + f->store_line("static const int _builtin_font_img_height="+itos(img.get_height())+";"); - for(int j=0;j<img.get_width();j++) { + String fname = p_font.basename()+".sv.png"; + ResourceSaver::save(fname,tex); + Vector<uint8_t> data=FileAccess::get_file_as_array(fname); - Color c = img.get_pixel(j,i); - int v = CLAMP(((c.r+c.g+c.b)/3.0)*255,0,255); - int a = CLAMP(c.a*255,0,255); - f->store_line(itos(v)+","+itos(a)+","); - } + f->store_line("static const int _builtin_font_img_data_size="+itos(data.size())+";"); + f->store_line("static const unsigned char _builtin_font_img_data["+itos(data.size())+"]={"); + + + + for(int i=0;i<data.size();i++) { + + f->store_line(itos(data[i])+","); + } f->store_line("};"); |