static void
htdoc_layout(fz_context *ctx, fz_document *doc_, float w, float h, float em)
{
	html_document *doc = (html_document*)doc_;
	doc->page_margin[T] = em;
	doc->page_margin[B] = em;
	doc->page_margin[L] = 0;
	doc->page_margin[R] = 0;
	doc->page_w = w - doc->page_margin[L] - doc->page_margin[R];
	doc->page_h = h - doc->page_margin[T] - doc->page_margin[B];
	doc->em = em;
	fz_layout_html(ctx, doc->box, doc->page_w, doc->page_h, doc->em);
}
Beispiel #2
0
static void
epub_layout(fz_context *ctx, fz_document *doc_, float w, float h, float em)
{
	epub_document *doc = (epub_document*)doc_;
	epub_chapter *ch;
	int count = 0;

	for (ch = doc->spine; ch; ch = ch->next)
	{
		ch->start = count;
		fz_layout_html(ctx, ch->html, w, h, em);
		count += ceilf(ch->html->root->h / ch->html->page_h);
	}

	epub_update_outline(ctx, doc_, doc->outline);
}
Beispiel #3
0
static void
htdoc_layout(fz_context *ctx, fz_document *doc_, float w, float h, float em)
{
	html_document *doc = (html_document*)doc_;

	if (doc->box)
	{
		doc->page_margin[T] = fz_from_css_number(doc->box->style.margin[T], em, em);
		doc->page_margin[B] = fz_from_css_number(doc->box->style.margin[B], em, em);
		doc->page_margin[L] = fz_from_css_number(doc->box->style.margin[L], em, em);
		doc->page_margin[R] = fz_from_css_number(doc->box->style.margin[R], em, em);
	}

	doc->page_w = w - doc->page_margin[L] - doc->page_margin[R];
	doc->page_h = h - doc->page_margin[T] - doc->page_margin[B];
	doc->em = em;

	fz_layout_html(ctx, doc->box, doc->page_w, doc->page_h, doc->em);
}
Beispiel #4
0
static void
epub_layout(fz_context *ctx, fz_document *doc_, float w, float h, float em)
{
	epub_document *doc = (epub_document*)doc_;
	epub_chapter *ch;

	printf("epub: laying out chapters.\n");
	for (ch = doc->spine; ch; ch = ch->next)
	{
		ch->em = em;
		ch->page_margin[T] = fz_from_css_number(ch->box->style.margin[T], em, em);
		ch->page_margin[B] = fz_from_css_number(ch->box->style.margin[B], em, em);
		ch->page_margin[L] = fz_from_css_number(ch->box->style.margin[L], em, em);
		ch->page_margin[R] = fz_from_css_number(ch->box->style.margin[R], em, em);
		ch->page_w = w - ch->page_margin[L] - ch->page_margin[R];
		ch->page_h = h - ch->page_margin[T] - ch->page_margin[B];
		fz_layout_html(ctx, ch->box, ch->page_w, ch->page_h, ch->em);
	}
	printf("epub: done.\n");
}