references
This commit is contained in:
parent
8ea44e780a
commit
e1ee9ae1a6
1
font.c
1
font.c
@ -192,6 +192,7 @@ void font_stub_encode(char output[], int size, int code, const Font_Table* table
|
|||||||
|
|
||||||
if (flags & FLAG_FONT_TAGS) {
|
if (flags & FLAG_FONT_TAGS) {
|
||||||
snprintf(output, size, "{?%.8x}", code);
|
snprintf(output, size, "{?%.8x}", code);
|
||||||
|
output[size - 1] = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
encode_sequence(output, size, "\xef\xbf\xbd");
|
encode_sequence(output, size, "\xef\xbf\xbd");
|
||||||
|
25
hooks.c
25
hooks.c
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "hooks.h"
|
#include "hooks.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -90,7 +91,6 @@ HOOK_TAGGER(end_mono_graphic); /* EB_HOOK_END_MONO_GRAPHIC */
|
|||||||
HOOK_TAGGER(end_mpeg); /* EB_HOOK_END_MPEG */
|
HOOK_TAGGER(end_mpeg); /* EB_HOOK_END_MPEG */
|
||||||
HOOK_TAGGER(end_narrow); /* EB_HOOK_END_NARROW */
|
HOOK_TAGGER(end_narrow); /* EB_HOOK_END_NARROW */
|
||||||
HOOK_TAGGER(end_no_newline); /* EB_HOOK_END_NO_NEWLINE */
|
HOOK_TAGGER(end_no_newline); /* EB_HOOK_END_NO_NEWLINE */
|
||||||
HOOK_TAGGER(end_reference); /* EB_HOOK_END_REFERENCE */
|
|
||||||
HOOK_TAGGER(end_subscript); /* EB_HOOK_END_SUBSCRIPT */
|
HOOK_TAGGER(end_subscript); /* EB_HOOK_END_SUBSCRIPT */
|
||||||
HOOK_TAGGER(end_superscript); /* EB_HOOK_END_SUPERSCRIPT */
|
HOOK_TAGGER(end_superscript); /* EB_HOOK_END_SUPERSCRIPT */
|
||||||
HOOK_TAGGER(end_unicode); /* EB_HOOK_END_UNICODE */
|
HOOK_TAGGER(end_unicode); /* EB_HOOK_END_UNICODE */
|
||||||
@ -100,6 +100,27 @@ HOOK_TAGGER(newline); /* EB_HOOK_NEWLINE */
|
|||||||
HOOK_TAGGER(null); /* EB_HOOK_NULL */
|
HOOK_TAGGER(null); /* EB_HOOK_NULL */
|
||||||
HOOK_TAGGER(set_indent); /* EB_HOOK_SET_INDENT */
|
HOOK_TAGGER(set_indent); /* EB_HOOK_SET_INDENT */
|
||||||
|
|
||||||
|
static EB_Error_Code hook_end_reference( /* EB_HOOK_END_REFERENCE */
|
||||||
|
EB_Book* book,
|
||||||
|
EB_Appendix* appendix,
|
||||||
|
void* container,
|
||||||
|
EB_Hook_Code code,
|
||||||
|
int argc,
|
||||||
|
const unsigned int argv[]
|
||||||
|
) {
|
||||||
|
(void)appendix;
|
||||||
|
(void)container;
|
||||||
|
(void)code;
|
||||||
|
|
||||||
|
assert(argc >= 3);
|
||||||
|
char ref[256];
|
||||||
|
snprintf(ref, ARRSIZE(ref), "<end_reference page=%d offset=%d>", argv[1], argv[2]);
|
||||||
|
ref[ARRSIZE(ref) - 1] = 0;
|
||||||
|
eb_write_text_string(book, ref);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static EB_Error_Code hook_narrow_font( /* EB_HOOK_NARROW_FONT */
|
static EB_Error_Code hook_narrow_font( /* EB_HOOK_NARROW_FONT */
|
||||||
EB_Book* book,
|
EB_Book* book,
|
||||||
EB_Appendix* appendix,
|
EB_Appendix* appendix,
|
||||||
@ -113,7 +134,7 @@ static EB_Error_Code hook_narrow_font( /* EB_HOOK_NARROW_FONT */
|
|||||||
|
|
||||||
Hook_Params* params = (Hook_Params*)container;
|
Hook_Params* params = (Hook_Params*)container;
|
||||||
|
|
||||||
assert(argc > 0);
|
assert(argc >= 1);
|
||||||
char stub[MAX_STUB_BYTES];
|
char stub[MAX_STUB_BYTES];
|
||||||
font_stub_encode(stub, ARRSIZE(stub), argv[0], params->table, FONT_WIDTH_NARROW, params->flags);
|
font_stub_encode(stub, ARRSIZE(stub), argv[0], params->table, FONT_WIDTH_NARROW, params->flags);
|
||||||
eb_write_text_string(book, stub);
|
eb_write_text_string(book, stub);
|
||||||
|
Loading…
Reference in New Issue
Block a user