WIP
This commit is contained in:
parent
06672bb78c
commit
1aa176f1cf
43
book.c
43
book.c
@ -263,14 +263,16 @@ static void subbook_encode(json_t* subbook_json, const Book_Subbook* subbook, in
|
|||||||
json_object_set_new(subbook_json, "fonts", font_json_array);
|
json_object_set_new(subbook_json, "fonts", font_json_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
json_t* entry_json_array = json_array();
|
if (flags & FLAG_ENTRIES) {
|
||||||
for (int i = 0; i < subbook->entry_count; ++i) {
|
json_t* entry_json_array = json_array();
|
||||||
json_t* entry_json = json_object();
|
for (int i = 0; i < subbook->entry_count; ++i) {
|
||||||
entry_encode(entry_json, subbook->entries + i, flags);
|
json_t* entry_json = json_object();
|
||||||
json_array_append_new(entry_json_array, entry_json);
|
entry_encode(entry_json, subbook->entries + i, flags);
|
||||||
}
|
json_array_append_new(entry_json_array, entry_json);
|
||||||
|
}
|
||||||
|
|
||||||
json_object_set_new(subbook_json, "entries", entry_json_array);
|
json_object_set_new(subbook_json, "entries", entry_json_array);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void book_encode(json_t* book_json, const Book* book, int flags) {
|
static void book_encode(json_t* book_json, const Book* book, int flags) {
|
||||||
@ -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;
|
Book_Glyph* glyph = glyph_set->glyphs + glyph_set->count;
|
||||||
glyph->code = font_code;
|
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) {
|
if (eb_narrow_font_character_bitmap(eb_book, font_code, glyph->bitmap) != EB_SUCCESS) {
|
||||||
break;
|
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;
|
Book_Glyph* glyph = glyph_set->glyphs + glyph_set->count;
|
||||||
glyph->code = font_code;
|
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) {
|
if (eb_wide_font_character_bitmap(eb_book, font_code, glyph->bitmap) != EB_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -450,19 +452,20 @@ static void subbook_import(Book_Subbook* subbook, EB_Book* eb_book, EB_Hookset*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eb_search_all_alphabet(eb_book) == EB_SUCCESS) {
|
if (flags & FLAG_ENTRIES) {
|
||||||
subbook_entries_import(subbook, eb_book, eb_hookset);
|
if (eb_search_all_alphabet(eb_book) == EB_SUCCESS) {
|
||||||
|
subbook_entries_import(subbook, eb_book, eb_hookset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eb_search_all_kana(eb_book) == EB_SUCCESS) {
|
||||||
|
subbook_entries_import(subbook, eb_book, eb_hookset);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eb_search_all_asis(eb_book) == EB_SUCCESS) {
|
||||||
|
subbook_entries_import(subbook, eb_book, eb_hookset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eb_search_all_kana(eb_book) == EB_SUCCESS) {
|
|
||||||
subbook_entries_import(subbook, 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) {
|
if (flags & FLAG_FONTS) {
|
||||||
const EB_Font_Code codes[] = {EB_FONT_16, EB_FONT_24, EB_FONT_30, EB_FONT_48};
|
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) {
|
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' },
|
{ "markup", no_argument, NULL, 'm' },
|
||||||
{ "positions", no_argument, NULL, 's' },
|
{ "positions", no_argument, NULL, 's' },
|
||||||
{ "fonts", no_argument, NULL, 'f' },
|
{ "fonts", no_argument, NULL, 'f' },
|
||||||
|
{ "entries", no_argument, NULL, 'e' },
|
||||||
{ NULL, 0, NULL, 0 },
|
{ NULL, 0, NULL, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -57,6 +58,9 @@ int main(int argc, char *argv[]) {
|
|||||||
case 'f':
|
case 'f':
|
||||||
flags |= FLAG_FONTS;
|
flags |= FLAG_FONTS;
|
||||||
break;
|
break;
|
||||||
|
case 'e':
|
||||||
|
flags |= FLAG_ENTRIES;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user