WIP
This commit is contained in:
parent
06672bb78c
commit
1aa176f1cf
9
book.c
9
book.c
@ -263,6 +263,7 @@ static void subbook_encode(json_t* subbook_json, const Book_Subbook* subbook, in
|
||||
json_object_set_new(subbook_json, "fonts", font_json_array);
|
||||
}
|
||||
|
||||
if (flags & FLAG_ENTRIES) {
|
||||
json_t* entry_json_array = json_array();
|
||||
for (int i = 0; i < subbook->entry_count; ++i) {
|
||||
json_t* entry_json = json_object();
|
||||
@ -272,6 +273,7 @@ static void subbook_encode(json_t* subbook_json, const Book_Subbook* subbook, in
|
||||
|
||||
json_object_set_new(subbook_json, "entries", entry_json_array);
|
||||
}
|
||||
}
|
||||
|
||||
static void book_encode(json_t* book_json, const Book* book, int flags) {
|
||||
json_object_set_new(book_json, "charCode", json_string(book->char_code));
|
||||
@ -367,7 +369,7 @@ static void subbook_font_import(Book_Font* font, EB_Book* eb_book, EB_Font_Code
|
||||
|
||||
Book_Glyph* glyph = glyph_set->glyphs + glyph_set->count;
|
||||
glyph->code = font_code;
|
||||
memset(glyph->bitmap, 0, sizeof(glyph->bitmap));
|
||||
memset(glyph->bitmap, 0, glyph_set->bitmap_size);
|
||||
if (eb_narrow_font_character_bitmap(eb_book, font_code, glyph->bitmap) != EB_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
@ -422,7 +424,7 @@ static void subbook_font_import(Book_Font* font, EB_Book* eb_book, EB_Font_Code
|
||||
|
||||
Book_Glyph* glyph = glyph_set->glyphs + glyph_set->count;
|
||||
glyph->code = font_code;
|
||||
memset(glyph->bitmap, 0, sizeof(glyph->bitmap));
|
||||
memset(glyph->bitmap, 0, glyph_set->bitmap_size);
|
||||
if (eb_wide_font_character_bitmap(eb_book, font_code, glyph->bitmap) != EB_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
@ -450,6 +452,7 @@ static void subbook_import(Book_Subbook* subbook, EB_Book* eb_book, EB_Hookset*
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & FLAG_ENTRIES) {
|
||||
if (eb_search_all_alphabet(eb_book) == EB_SUCCESS) {
|
||||
subbook_entries_import(subbook, eb_book, eb_hookset);
|
||||
}
|
||||
@ -461,8 +464,8 @@ static void subbook_import(Book_Subbook* subbook, EB_Book* eb_book, EB_Hookset*
|
||||
if (eb_search_all_asis(eb_book) == EB_SUCCESS) {
|
||||
subbook_entries_import(subbook, eb_book, eb_hookset);
|
||||
}
|
||||
}
|
||||
|
||||
memset(subbook->fonts, 0, sizeof(subbook->fonts));
|
||||
if (flags & FLAG_FONTS) {
|
||||
const EB_Font_Code codes[] = {EB_FONT_16, EB_FONT_24, EB_FONT_30, EB_FONT_48};
|
||||
for (unsigned i = 0; i < ARRSIZE(codes); ++i) {
|
||||
|
4
main.c
4
main.c
@ -36,6 +36,7 @@ int main(int argc, char *argv[]) {
|
||||
{ "markup", no_argument, NULL, 'm' },
|
||||
{ "positions", no_argument, NULL, 's' },
|
||||
{ "fonts", no_argument, NULL, 'f' },
|
||||
{ "entries", no_argument, NULL, 'e' },
|
||||
{ NULL, 0, NULL, 0 },
|
||||
};
|
||||
|
||||
@ -57,6 +58,9 @@ int main(int argc, char *argv[]) {
|
||||
case 'f':
|
||||
flags |= FLAG_FONTS;
|
||||
break;
|
||||
case 'e':
|
||||
flags |= FLAG_ENTRIES;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user