[cairo] cairo Digest, Vol 34, Issue 25

satyanarayana satyanarayana.tirupathi at valuelabs.net
Wed May 14 22:05:34 PDT 2008


Hi,
how to rotate  jpg image with cairo graphics and how to compile the cairo 
source code with mipsel-linux-g++ compiler.

Regards,
----- Original Message ----- 
From: <cairo-request at cairographics.org>
To: <cairo at cairographics.org>
Sent: Thursday, May 15, 2008 12:30 AM
Subject: cairo Digest, Vol 34, Issue 25


> Send cairo mailing list submissions to
> cairo at cairographics.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.cairographics.org/mailman/listinfo/cairo
> or, via email, send a message with subject or body 'help' to
> cairo-request at cairographics.org
>
> You can reach the person managing the list at
> cairo-owner at cairographics.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of cairo digest..."
>
>
> Today's Topics:
>
>   1. Re: eps file (Carl Worth)
>   2. Re: User-fonts landed (Adrian Johnson)
>   3. Pango Cairo Rendering Text with Misc Fonts (robertk54 at aol.com)
>   4. Re: PDF output always different (Kristof Van Landschoot)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 13 May 2008 12:17:43 -0700
> From: Carl Worth <cworth at cworth.org>
> Subject: Re: [cairo] eps file
> To: Adrian Johnson <ajohnson at redneon.com>
> Cc: cairo at cairographics.org
> Message-ID: <87d4nqqai0.wl%cworth at cworth.org>
> Content-Type: text/plain; charset="us-ascii"
>
> On Tue, 13 May 2008 22:49:56 +0930, Adrian Johnson wrote:
>> Paolo Chiodi wrote:
>> > Hi all, i'm new to this mailing list and to cairo graphics.
>> > I need to develop an application that creates a pdf by importing some
>> > vector images from eps file.
>> > I've tried some tools but none succesfully (usually the tools i've
>> > tried need to rasterize the image, others generate bad page layout).
>> > My last idea was to use cairo with pdf surface to create my pdf
>> > document. then my question is: can cairo imports eps image? does it
>> > rasterize the image or keep it vector-based?
>>
>> The way to do this to first convert the EPS file to PDF using
>> Ghostscript then render the PDF using poppler. When using poppler to
>> create output from any of the cairo vector backends such as PS and PDF
>> the vectors will not be rasterized.
>
> This is a fine workaround for now.
>
> Meanwhile, while at LGM, Ralph Giles and Behdad Esfahbod worked
> together to teach ghostscript how to render through cairo. So that
> should soon give us a much more direct way to get from PostScript/EPS
> to cairo.
>
> -Carl
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 189 bytes
> Desc: not available
> Url : 
> http://lists.cairographics.org/archives/cairo/attachments/20080513/7efe066a/attachment-0001.pgp
>
> ------------------------------
>
> Message: 2
> Date: Thu, 15 May 2008 00:06:43 +0930
> From: Adrian Johnson <ajohnson at redneon.com>
> Subject: Re: [cairo] User-fonts landed
> To: Behdad Esfahbod <behdad at behdad.org>
> Cc: Kristian H?gsberg <krh at bitplanet.net>, cairo
> <cairo at cairographics.org>
> Message-ID: <482AF8FB.10307 at redneon.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Behdad Esfahbod wrote:
>> On Tue, 2008-05-13 at 12:46 -0400, Behdad Esfahbod wrote:
>>> Thanks Kristian.  Did that, and found a bug with my traps_path().
>>> Fixing that and then I'll push.
>>
>> Humm, looks like a Type1 bug, not traps.  Adrian, can you run user-font
>> and check out?
>
> It does not appear to be a Type1-fallback problem. The path that
> Type1-fallback is getting from _cairo_scaled_glyph_lookup() is broken.
> It is easy to see if the user-font stroke is changed to butt caps and
> miter joins to reduce the number of paths.
>
>>
>> Also, there seems to be some strong assumptions about glyph 0.  Try
>> removing the first line in glyph definitions of test/user-font.c and
>> watch the new glyph 0 not showing up in PDF output...
>
> It works fine with acroread. Looks like a poppler problem.
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 14 May 2008 11:35:33 -0400
> From: robertk54 at aol.com
> Subject: [cairo] Pango Cairo Rendering Text with Misc Fonts
> To: cairo at cairographics.org
> Message-ID: <8CA83EF485A9260-1070-6BA at WEBMAIL-MB16.sysops.aol.com>
> Content-Type: text/plain; charset="us-ascii"; format=flowed
>
> I switched to a Linux prototype and have a simple test app which
> renders text on top of an ARGB surface and saves to a .png file.  I am
> still having some issues with rendering text when selecting
> international fonts.  It's almost as if Cairo is using the toy fonts
> but some fonts render good.  The version of Pango I am currently using
> is older and does not support Gravity so I am not trying to render
> vertical text.
>
> Fonts I tried, all render in english and are not very different from
> each other so I do not think they are all good . . .
>
> Century Schoolbook L
> Courier
> Drugulin CLM
> East Syriac Adiabene
> Frank Ruehl CLM
> KacstDecorative
> KacstQura
> Kochi Mincho
> Lohit Punjabi
> Lohit Tamil
> Miriam Mono CLM
> Mukti Narrow
> Serto Batnan
> Serto Jerusalem Outline
> ZYSong18030
>
> Most of my current test app . . .
>
> <<
> #include <unistd.h>
> #include <stdio.h>
>
> #include <pango/pangocairo.h>
>
> #define FOURCIF_WIDTH   704
> #define FOURCIF_HEIGHT  476
>
> #if !defined(CAIRO_HAS_FT_FONT)
> #error !CAIRO_HAS_FT_FONT
> #endif
>
> static cairo_t *m_pCairo=NULL;
> static cairo_surface_t *m_pSurface=NULL;
> static cairo_surface_t *m_pSurfaceSample=NULL;static double
> m_dXPosStart=0.0;
> static double m_dYPosStart=0.0;
> static double m_dXPos=0.0;
> static double m_dYPos=0.0;
> static char *m_pUtf8=NULL;
> static char *m_pColor=NULL;
> static char *m_pFont=NULL;
> static PangoLayout *m_pPangoLayout=NULL;
> static PangoFontMap *m_pPangoFontMap=NULL;
> static double m_size=12.0;
> static double m_r=1.0, m_g=0.0, m_b=0.0, m_a=1.0;
> static double m_dTransparency = 0.0;
> static int m_iNumFonts;
>
> void ListFonts (void);
> void ParseParameters (int argc, char *argv[]);
> void SetFont ( const char *font);
> void SetRGB (unsigned char r, unsigned char g, unsigned char b,
> unsigned char a);
> void HTML40ToRGB(char *HTML40, unsigned char *R, unsigned char *G,
> unsigned char *B);
> void AddText (const char *utf8);
>
> int main(int argc, char *argv[])
> {
>   // Default initial color blue
>   unsigned char R = 0;
>   unsigned char G = 0;
>   unsigned char B = 255;
>   unsigned char A = 255;
>   double dNorm;
>
>    m_pSurface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
> FOURCIF_WIDTH, FOURCIF_HEIGHT);
>   m_pCairo = cairo_create (m_pSurface);
>   cairo_set_source_rgba (m_pCairo, R, G, B, A);
>   cairo_paint (m_pCairo);
>    m_pSurfaceSample = cairo_image_surface_create_from_png
> ("sample.png");
>    cairo_set_source_surface (m_pCairo, m_pSurfaceSample,
> FOURCIF_WIDTH*0.21, 0);
>   cairo_paint (m_pCairo);
>   m_pPangoFontMap = pango_cairo_font_map_get_default ();
>   m_pPangoLayout = pango_cairo_create_layout (m_pCairo);
>
>   ParseParameters (argc, argv);
>
>   dNorm = m_dTransparency;
>   dNorm = (dNorm < 0.0) ? 0.0 : dNorm;
>   dNorm = (dNorm > 1.0) ? 1.0 : dNorm;
>   A = (unsigned char) ((1.0 - dNorm) * 255.0) & 0xff;
>
>   HTML40ToRGB (m_pColor, &R, &G, &B);
>   SetRGB (R, G, B, A);
>   SetFont (m_pFont);
>
>   AddText (m_pUtf8);
>
>   g_object_unref (m_pPangoLayout);
>   // Write the ARGB surface to a .PNG file so we can view it.
>   cairo_surface_write_to_png (m_pSurface, "utf8test-pango.png");
>   return 0;
> }
>
> void ListFonts ()
> {
>   PangoFontMap     *pPangoFontMap;
>   PangoFontFamily **pPangoFontFamily;
>   PangoFontFace   **pPangoFontFace;
>   int n_faces;
>   int n_families;
>   int i;
>   int j;
>
>   m_iNumFonts = 0;
>   pPangoFontMap = pango_cairo_font_map_get_default ();
>    pango_font_map_list_families (pPangoFontMap, &pPangoFontFamily,
> &n_families);
>    // Determine the font string and insert into (alpabetically sorted)
> combo list.
>   for (i=0; i<n_families; i++)
>   {
>       pango_font_family_list_faces (pPangoFontFamily[i],
> &pPangoFontFace, &n_faces);
>       printf ("%s :: [", pango_font_family_get_name
> (pPangoFontFamily[i]));
>      for (j=0; j<n_faces; j++)
>      {
>          printf ("%s", pango_font_face_get_face_name
> (pPangoFontFace[j]));
>         if (j+1 < n_faces) printf (", ");
>         m_iNumFonts++;
>      }
>      printf ("]\n");
>   }
>   g_free (pPangoFontFace);
>   g_free (pPangoFontFamily);
> }
>
> void AddText (const char *utf8)
> {
>   PangoAttrList* pPangoAttrList;
>   gchar *text;
>   // Get the layout's current attribute list
>   pPangoAttrList = pango_layout_get_attributes (m_pPangoLayout);
>
> /////////////////////////////////////////////////////////////////////////
> /
>    // Would be nice to extend the markup language for dynamic
> attributes.
>    // These would need to be processed and stripped here, prior to the
> pango_parse_markup call.
>
> /////////////////////////////////////////////////////////////////////////
> /
>   // Update the attribute list from the markup text.
>   pango_parse_markup (utf8, -1, 0, &pPangoAttrList, &text, NULL, NULL);
>   pango_layout_set_attributes (m_pPangoLayout, pPangoAttrList);
>   pango_attr_list_unref (pPangoAttrList);
>   pango_layout_set_text (m_pPangoLayout, text, -1);
>   // Set the color and position of the cairo context.
>   cairo_set_source_rgba (m_pCairo, m_r, m_g, m_b, m_a);
>   cairo_save (m_pCairo);
>   cairo_move_to (m_pCairo, m_dXPos+m_dXPosStart, m_dYPos+m_dYPosStart);
>   // Let the pango layout know of the context changes above.
>   pango_layout_context_changed (m_pPangoLayout);
>   pango_cairo_update_layout (m_pCairo, m_pPangoLayout);
>   pango_cairo_show_layout (m_pCairo, m_pPangoLayout);
>   cairo_restore (m_pCairo);
> };
>
> void SetFont (const char *font)
> {
>   PangoFontDescription* pPangoFontDescription=NULL;
>   double dSize;
>
>   pPangoFontDescription = pango_font_description_from_string (font);
>    dSize = m_size * cairo_image_surface_get_height (m_pSurface) / 100.0
> * PANGO_SCALE;
>    pango_font_description_set_absolute_size (pPangoFontDescription,
> dSize);
>    pango_layout_set_font_description (m_pPangoLayout,
> pPangoFontDescription);
>    printf ("%s : %s : %d : %d\n", font,
> pango_font_description_to_string (pPangoFontDescription), (int) m_size,
> (int) dSize);
>   pango_font_description_free (pPangoFontDescription);
>   pPangoFontDescription = NULL;
> };
>>>
>
>
> ------------------------------
>
> Message: 4
> Date: Wed, 14 May 2008 18:13:18 +0200
> From: "Kristof Van Landschoot" <kristof at coin-c.com>
> Subject: Re: [cairo] PDF output always different
> To: cairo at cairographics.org, "Adrian Johnson" <ajohnson at redneon.com>
> Message-ID:
> <bf3a15e10805140913l1b5fff68k6b03ea4a9f2a8995 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Adrian,
>
> On Tue, May 13, 2008 at 2:23 PM, Adrian Johnson <ajohnson at redneon.com>
> wrote:
>
>>
>> I've attached a patch that ensures the fonts are embedded in a 
>> predictable
>> order. Let us know if this fixes the problem.
>>
>
>
> It does!  Thanks a lot!
>
> Best Regards,
> kristof
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> http://lists.cairographics.org/archives/cairo/attachments/20080514/92ab54b1/attachment.htm
>
> ------------------------------
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
> End of cairo Digest, Vol 34, Issue 25
> *************************************
> 



More information about the cairo mailing list