xournal: update to 0.4.6

This commit is contained in:
davehome 2012-06-30 01:56:47 -06:00
parent d0aa731ad4
commit c0b33e811b
4 changed files with 11 additions and 255 deletions

View file

@ -1,89 +0,0 @@
diff -aur old/src/xo-print.c new/src/xo-print.c
--- src/xo-print.c 2009-09-28 23:36:54.000000000 +0200
+++ src/xo-print.c 2009-11-15 06:06:00.000000000 +0100
@@ -761,7 +761,7 @@
make_xref(xref, xref->last+1, pdfbuf->len);
g_string_append_printf(pdfbuf,
- "%d 0 obj\n<< /Length %d /Filter /FlateDecode /Type /Xobject "
+ "%d 0 obj\n<< /Length %zu /Filter /FlateDecode /Type /Xobject "
"/Subtype /Image /Width %d /Height %d /ColorSpace /DeviceRGB "
"/BitsPerComponent 8 >> stream\n",
xref->last, zpix->len, width, height);
@@ -840,8 +840,10 @@
gboolean fallback, is_binary;
guchar encoding[256];
gushort glyphs[256];
- int i, j, num, len1, len2;
- gsize len;
+ int i, j, num;
+ guint32 len1, len2;
+ guint32 tt_len;
+ gsize t1_len;
TrueTypeFont *ttfnt;
char *seg1, *seg2;
char *fontdata, *p;
@@ -862,14 +864,14 @@
}
font->num_glyphs_used = num-1;
if (OpenTTFont(font->filename, 0, &ttfnt) == SF_OK) {
- if (CreateTTFromTTGlyphs_tomemory(ttfnt, (guint8**)&fontdata, &len, glyphs, encoding, num,
+ if (CreateTTFromTTGlyphs_tomemory(ttfnt, (guint8**)&fontdata, &tt_len, glyphs, encoding, num,
0, NULL, TTCF_AutoName | TTCF_IncludeOS2) == SF_OK) {
make_xref(xref, xref->last+1, pdfbuf->len);
nobj_fontprog = xref->last;
g_string_append_printf(pdfbuf,
- "%d 0 obj\n<< /Length %d /Length1 %d >> stream\n",
- nobj_fontprog, (int)len, (int)len);
- g_string_append_len(pdfbuf, fontdata, len);
+ "%d 0 obj\n<< /Length %u /Length1 %u >> stream\n",
+ nobj_fontprog, tt_len, tt_len);
+ g_string_append_len(pdfbuf, fontdata, tt_len);
g_string_append(pdfbuf, "endstream\nendobj\n");
g_free(fontdata);
}
@@ -879,7 +881,7 @@
else fallback = TRUE;
} else {
// embed the font file: Type1 case
- if (g_file_get_contents(font->filename, &fontdata, &len, NULL) && len>=8) {
+ if (g_file_get_contents(font->filename, &fontdata, &t1_len, NULL) && t1_len>=8) {
if (fontdata[0]==(char)0x80 && fontdata[1]==(char)0x01) {
is_binary = TRUE;
len1 = pfb_get_length((unsigned char *)fontdata+2);
@@ -898,7 +900,7 @@
if (*p=='\n' || *p=='\r') p++;
if (*p=='\n' || *p=='\r') p++;
len1 = p-fontdata;
- p = g_strrstr_len(fontdata, len, T1_SEGMENT_3_END);
+ p = g_strrstr_len(fontdata, t1_len, T1_SEGMENT_3_END);
if (p==NULL) fallback = TRUE;
else {
// rewind 512 zeros
@@ -936,7 +938,7 @@
make_xref(xref, xref->last+1, pdfbuf->len);
nobj_fontprog = xref->last;
g_string_append_printf(pdfbuf,
- "%d 0 obj\n<< /Length %d /Length1 %d /Length2 %d /Length3 0 >> stream\n",
+ "%d 0 obj\n<< /Length %u /Length1 %u /Length2 %u /Length3 0 >> stream\n",
nobj_fontprog, len1+len2, len1, len2);
g_string_append_len(pdfbuf, seg1, len1);
g_string_append_len(pdfbuf, seg2, len2);
@@ -1258,7 +1260,7 @@
tmpstr = make_pdfprefix(pdfinfo.pages+(pg->bg->file_page_seq-1),
pg->width, pg->height);
g_string_append_printf(pdfbuf,
- "%d 0 obj\n<< /Length %d >> stream\n%s\nendstream\nendobj\n",
+ "%d 0 obj\n<< /Length %zu >> stream\n%s\nendstream\nendobj\n",
n_obj_prefix, tmpstr->len, tmpstr->str);
g_string_free(tmpstr, TRUE);
g_string_prepend(pgstrm, "Q Q Q ");
@@ -1276,7 +1278,7 @@
make_xref(&xref, xref.last+1, pdfbuf->len);
g_string_append_printf(pdfbuf,
- "%d 0 obj\n<< /Length %d /Filter /FlateDecode>> stream\n",
+ "%d 0 obj\n<< /Length %zu /Filter /FlateDecode>> stream\n",
xref.last, zpgstrm->len);
g_string_append_len(pdfbuf, zpgstrm->str, zpgstrm->len);
g_string_free(zpgstrm, TRUE);

View file

@ -1,158 +0,0 @@
diff -aur old/src/xo-file.c new/src/xo-file.c
--- src/xo-file.c 2009-09-29 09:36:05.000000000 +1000
+++ src/xo-file.c 2011-10-06 03:11:17.307822836 +1100
@@ -975,6 +975,140 @@
g_free(req);
}
+/*
+ * Copied from http://cgit.freedesktop.org/poppler/poppler/tree/glib/poppler-page.cc?h=poppler-0.16#n617
+ * as a temporary workaround to poppler removing depreciated functions while we wait for
+ * upstream to rewrite against cairo
+ */
+static void
+copy_cairo_surface_to_pixbuf (cairo_surface_t *surface, GdkPixbuf *pixbuf)
+{
+ int cairo_width, cairo_height, cairo_rowstride;
+ unsigned char *pixbuf_data, *dst, *cairo_data;
+ int pixbuf_rowstride, pixbuf_n_channels;
+ unsigned int *src;
+ int x, y;
+
+ cairo_width = cairo_image_surface_get_width (surface);
+ cairo_height = cairo_image_surface_get_height (surface);
+ cairo_rowstride = cairo_image_surface_get_stride (surface);
+ cairo_data = cairo_image_surface_get_data (surface);
+
+ pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
+ pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+ pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+
+ if (cairo_width > gdk_pixbuf_get_width (pixbuf))
+ cairo_width = gdk_pixbuf_get_width (pixbuf);
+ if (cairo_height > gdk_pixbuf_get_height (pixbuf))
+ cairo_height = gdk_pixbuf_get_height (pixbuf);
+ for (y = 0; y < cairo_height; y++)
+ {
+ src = (unsigned int *) (cairo_data + y * cairo_rowstride);
+ dst = pixbuf_data + y * pixbuf_rowstride;
+ for (x = 0; x < cairo_width; x++)
+ {
+ dst[0] = (*src >> 16) & 0xff;
+ dst[1] = (*src >> 8) & 0xff;
+ dst[2] = (*src >> 0) & 0xff;
+ if (pixbuf_n_channels == 4)
+ dst[3] = (*src >> 24) & 0xff;
+ dst += pixbuf_n_channels;
+ src++;
+ }
+ }
+}
+
+static void
+_poppler_page_render_to_pixbuf (PopplerPage *page,
+ int src_x, int src_y,
+ int src_width, int src_height,
+ double scale,
+ int rotation,
+ gboolean printing,
+ GdkPixbuf *pixbuf)
+{
+ cairo_t *cr;
+ cairo_surface_t *surface;
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ src_width, src_height);
+ cr = cairo_create (surface);
+ cairo_save (cr);
+ switch (rotation) {
+ case 90:
+ cairo_translate (cr, src_x + src_width, -src_y);
+ break;
+ case 180:
+ cairo_translate (cr, src_x + src_width, src_y + src_height);
+ break;
+ case 270:
+ cairo_translate (cr, -src_x, src_y + src_height);
+ break;
+ default:
+ cairo_translate (cr, -src_x, -src_y);
+ }
+
+ if (scale != 1.0)
+ cairo_scale (cr, scale, scale);
+
+ if (rotation != 0)
+ cairo_rotate (cr, rotation * G_PI / 180.0);
+
+ if (printing)
+ poppler_page_render_for_printing (page, cr);
+ else
+ poppler_page_render (page, cr);
+ cairo_restore (cr);
+
+ cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER);
+ cairo_set_source_rgb (cr, 1., 1., 1.);
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
+
+ copy_cairo_surface_to_pixbuf (surface, pixbuf);
+ cairo_surface_destroy (surface);
+}
+
+/**
+ * poppler_page_render_to_pixbuf:
+ * @page: the page to render from
+ * @src_x: x coordinate of upper left corner
+ * @src_y: y coordinate of upper left corner
+ * @src_width: width of rectangle to render
+ * @src_height: height of rectangle to render
+ * @scale: scale specified as pixels per point
+ * @rotation: rotate the document by the specified degree
+ * @pixbuf: pixbuf to render into
+ *
+ * First scale the document to match the specified pixels per point,
+ * then render the rectangle given by the upper left corner at
+ * (src_x, src_y) and src_width and src_height.
+ * This function is for rendering a page that will be displayed.
+ * If you want to render a page that will be printed use
+ * poppler_page_render_to_pixbuf_for_printing() instead
+ *
+ * Deprecated: 0.16
+ **/
+void
+poppler_page_render_to_pixbuf (PopplerPage *page,
+ int src_x, int src_y,
+ int src_width, int src_height,
+ double scale,
+ int rotation,
+ GdkPixbuf *pixbuf)
+{
+ g_return_if_fail (POPPLER_IS_PAGE (page));
+ g_return_if_fail (scale > 0.0);
+ g_return_if_fail (pixbuf != NULL);
+
+ _poppler_page_render_to_pixbuf (page, src_x, src_y,
+ src_width, src_height,
+ scale, rotation,
+ FALSE,
+ pixbuf);
+}
/* process a bg PDF request from the queue, and recurse */
gboolean bgpdf_scheduler_callback(gpointer data)
diff -aur old/src/xo-file.h new/src/xo-file.h
--- src/xo-file.h 2009-09-28 08:45:53.000000000 +1000
+++ src/xo-file.h 2011-10-06 03:11:17.311156160 +1100
@@ -36,3 +36,10 @@
void init_config_default(void);
void load_config_from_file(void);
void save_config_to_file(void);
+
+void poppler_page_render_to_pixbuf (PopplerPage *page,
+ int src_x, int src_y,
+ int src_width, int src_height,
+ double scale,
+ int rotation,
+ GdkPixbuf *pixbuf);

View file

@ -1,21 +1,22 @@
# Template file for 'xournal' # Template file for 'xournal'
pkgname=xournal pkgname=xournal
version=0.4.5 version=0.4.6
revision=3 revision=1
distfiles="${SOURCEFORGE_SITE}/$pkgname/$pkgname-$version.tar.gz" distfiles="${SOURCEFORGE_SITE}/$pkgname/$pkgname-$version.tar.gz"
build_style=gnu-configure build_style=gnu-configure
make_install_args="desktop-install" make_install_args="desktop-install"
makedepends="pkg-config gtk+-devel libgnomecanvas-devel>=2.30.3_1 poppler-glib-devel" makedepends="autoconf automake pkg-config gtk+-devel
fulldepends="hicolor-icon-theme desktop-file-utils" libgnomecanvas-devel>=2.30.3_1 poppler-glib-devel zlib-devel ghostscript-devel"
fulldepends="hicolor-icon-theme desktop-file-utils ghostscript"
short_desc="Xournal: GPL Notetaking, sketching, and journal-keeping." short_desc="Xournal: GPL Notetaking, sketching, and journal-keeping."
maintainer="davehome <davehome@redthumb.info.tm>" maintainer="davehome <davehome@redthumb.info.tm>"
homepage="http://xournal.sourceforge.net/" homepage="http://xournal.sourceforge.net/"
license="GPL-2" license="GPL-2"
checksum=a7d7c2cb544451939779276e6e5ee5acc756bd0efb5253de15dc00bfe07755d1 checksum=ec9008b49569514a9d12b810a8b92ef2c1c56590c964db66c2245d85f4eab058
long_desc=" long_desc="
Xournal is an application for notetaking, sketching, keeping a journal using Xournal is an application for notetaking, sketching, keeping a journal using
a stylus. It is free software (GNU GPL) and runs on Linux (recent a stylus. It is free software (GNU GPL) and runs on Linux (recent
distributions) and other GTK+/Gnome platforms. It is similar to Microsoft distributions) and other GTK+/GNOME platforms. It is similar to Microsoft
Windows Journal or to other alternatives such as Jarnal, Gournal, and Windows Journal or to other alternatives such as Jarnal, Gournal, and
NoteLab. NoteLab.
@ -26,4 +27,7 @@ long_desc="
gtk_iconcache_dirs="/usr/share/icons/hicolor" gtk_iconcache_dirs="/usr/share/icons/hicolor"
pre_configure() {
sed -i -e "s|lX11|lX11 -lm -lz|" src/Makefile.am
./autogen.sh
}

View file

@ -12,7 +12,6 @@ libpoppler-glib.so.8
libgobject-2.0.so.0 libgobject-2.0.so.0
libcairo.so.2 libcairo.so.2
libglib-2.0.so.0 libglib-2.0.so.0
libpthread.so.0
libc.so.6 libc.so.6
libm.so.6 libm.so.6
libX11.so.6 libX11.so.6