Re: [PD] pdp_text stange behaviour
ydegoyon escribió: ok, you're right, here's the right one.. Sorry, but still the same output. And I think this is a problem for select a font (it doesn't change!) thanks Husk ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] pdp_text stange behaviour
ydegoyon wrote: ola, it's a limitation here, as we use the imlib library that lets sets the font only globally in your application with : imlib_context_set_font( font ); i don't know any workaround for it. How about storing a different 'font' in each instance of 'pdp_text', and calling imlib_context_set_font() every time just before drawing text? Or would that be too inefficient? saluti, sevy Thanks, Claude ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] pdp_text stange behaviour
ok, it seems to work, here it is attached but i cannot commit to svn :: svn commit --username sevyves --password *** -m setting font before drawing pdp_text.c svn: Commit failed (details follow): svn: MKACTIVITY of '/svnroot/pure-data/!svn/act/b4c68913-14a6-4477-9381-0ceebc911e4c': 403 Forbidden (http://pure-data.svn.sourceforge.net) and don't ask, yes my password is allright ydegoyon wrote: Claude Heiland-Allen wrote: ydegoyon wrote: ola, it's a limitation here, as we use the imlib library that lets sets the font only globally in your application with : imlib_context_set_font( font ); i don't know any workaround for it. How about storing a different 'font' in each instance of 'pdp_text' this is already the case and calling imlib_context_set_font() every time just before drawing text? yeh that could be done, but maybe it's a little bit heavy? i can try cheers, sevy Or would that be too inefficient? saluti, sevy Thanks, Claude /* * PiDiP module * Copyright (c) by Yves Degoyon ([EMAIL PROTECTED]) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* This object is a text rendering object for PDP * It uses imlib2 for all graphical operations */ /* Listening to : * Deviants - Nothing Man * Monte Cazzaza - Kick That Habit Man */ #include pdp.h #include yuv.h #include math.h #include ctype.h #include Imlib2.h // imlib2 is required #define DEFAULT_CAPACITY 10 #define DEFAULT_FONT Vera/16 static char *pdp_text_version = pdp_text: version 0.2 : text rendering object written by [EMAIL PROTECTED]; typedef struct pdp_text_struct { t_object x_obj; t_float x_f; int x_packet0; int x_packet1; int x_dropped; int x_queue_id; t_outlet *x_outlet0; int x_vwidth; int x_vheight; int x_vsize; char **x_text_array; int *x_xoffsets; int *x_yoffsets; int *x_r; int *x_g; int *x_b; t_float *x_angle; t_float x_alpha; int *x_scroll; int x_nbtexts; int x_current; int x_capacity; /* imlib data */ Imlib_Image x_image; Imlib_Font x_font; } t_pdp_text; /* add a new text : syntax : text my%20text x y */ static void pdp_text_add(t_pdp_text *x, t_symbol *s, int argc, t_atom *argv) { char *pname; char *pdname; int len; if ( x-x_nbtexts = x-x_capacity ) { post( pdp_text : sorry, maximum capacity has been reached... try resize ); return; } if ( argc 3 ) { post( pdp_text : error in the number of arguments ( minimum is 3 ), argc ); return; } if ( argv[0].a_type != A_SYMBOL || argv[1].a_type != A_FLOAT || argv[2].a_type != A_FLOAT ) { post( pdp_text : add : wrong arguments ); return; } // allocate new text area len = strlen( argv[0].a_w.w_symbol-s_name ); pdname = x-x_text_array[x-x_nbtexts] = (char *) getbytes( len+1 ); pname = (char *) getbytes( len+1 ); memset( pname, 0x0, len+1 ); memcpy( pname, argv[0].a_w.w_symbol-s_name, len ); while (*(pname)) { if ( (*pname=='%') ( isdigit(*(pname+1)) || (*(pname+1)=='%') ) ) { int ivalue; int ndigits; char *piname; ndigits=0; piname=pname+1; while ( isdigit( *(piname++) ) ) ndigits++; ivalue=atoi(pname+1); // special case %% if ( ( pname != argv[0].a_w.w_symbol-s_name ) ( *(pname+1) == '%' ) ) { *(pdname++)=*(pname++); pname++; continue; } *(pdname++)=(char)ivalue; pname+=ndigits+1; } else if ( !strncmp( pname, \, 1 ) ) // quotes are ignored unless %34 { pname++; } else { *(pdname++)=*(pname++); } } *(pdname)='\0'; x-x_xoffsets[x-x_nbtexts] = (int)argv[1].a_w.w_float; x-x_yoffsets[x-x_nbtexts] = (int)argv[2].a_w.w_float; if ( (argc=4) (argv[3].a_type == A_FLOAT) ) { x-x_r[x-x_nbtexts] = (int)argv[3].a_w.w_float; } if ( (argc=5) (argv[4].a_type == A_FLOAT) ) { x-x_g[x-x_nbtexts] = (int)argv[4].a_w.w_float; } if ( (argc=6) (argv[5].a_type == A_FLOAT) ) { x-x_b[x-x_nbtexts] = (int)argv[5].a_w.w_float; } if ( (argc=7) (argv[6].a_type == A_FLOAT) ) {
Re: [PD] pdp_text stange behaviour
ydegoyon wrote: ok, it seems to work, here it is attached but i cannot commit to svn :: svn commit --username sevyves --password *** -m setting font before drawing pdp_text.c svn: Commit failed (details follow): svn: MKACTIVITY of '/svnroot/pure-data/!svn/act/b4c68913-14a6-4477-9381-0ceebc911e4c': 403 Forbidden (http://pure-data.svn.sourceforge.net) and don't ask, yes my password is allright your problems are most likely because of a scheduled downtime of the subversion servers: http://lists.puredata.info/pipermail/pd-dev/2008-09/012246.html fgadrm IOhannes ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] pdp_text stange behaviour
ok, you're right, here's the right one.. still unable to commit... husk wrote: ydegoyon escribió: ok, it seems to work, here it is attached Yes, it works! many thanks. just a warning output in my application: * Imlib2 Developer Warning * : This program is calling the Imlib call: imlib_get_text_size(); With the parameter: font being NULL. Please fix your program. See you soon in bcn Husk ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list /* * PiDiP module * Copyright (c) by Yves Degoyon ([EMAIL PROTECTED]) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* This object is a text rendering object for PDP * It uses imlib2 for all graphical operations */ /* Listening to : * Deviants - Nothing Man * Monte Cazzaza - Kick That Habit Man */ #include pdp.h #include yuv.h #include math.h #include ctype.h #include Imlib2.h // imlib2 is required #define DEFAULT_CAPACITY 10 #define DEFAULT_FONT Vera/16 static char *pdp_text_version = pdp_text: version 0.2 : text rendering object written by [EMAIL PROTECTED]; typedef struct pdp_text_struct { t_object x_obj; t_float x_f; int x_packet0; int x_packet1; int x_dropped; int x_queue_id; t_outlet *x_outlet0; int x_vwidth; int x_vheight; int x_vsize; char **x_text_array; int *x_xoffsets; int *x_yoffsets; int *x_r; int *x_g; int *x_b; t_float *x_angle; t_float x_alpha; int *x_scroll; int x_nbtexts; int x_current; int x_capacity; /* imlib data */ Imlib_Image x_image; Imlib_Font x_font; } t_pdp_text; /* add a new text : syntax : text my%20text x y */ static void pdp_text_add(t_pdp_text *x, t_symbol *s, int argc, t_atom *argv) { char *pname; char *pdname; int len; if ( x-x_nbtexts = x-x_capacity ) { post( pdp_text : sorry, maximum capacity has been reached... try resize ); return; } if ( argc 3 ) { post( pdp_text : error in the number of arguments ( minimum is 3 ), argc ); return; } if ( argv[0].a_type != A_SYMBOL || argv[1].a_type != A_FLOAT || argv[2].a_type != A_FLOAT ) { post( pdp_text : add : wrong arguments ); return; } // allocate new text area len = strlen( argv[0].a_w.w_symbol-s_name ); pdname = x-x_text_array[x-x_nbtexts] = (char *) getbytes( len+1 ); pname = (char *) getbytes( len+1 ); memset( pname, 0x0, len+1 ); memcpy( pname, argv[0].a_w.w_symbol-s_name, len ); while (*(pname)) { if ( (*pname=='%') ( isdigit(*(pname+1)) || (*(pname+1)=='%') ) ) { int ivalue; int ndigits; char *piname; ndigits=0; piname=pname+1; while ( isdigit( *(piname++) ) ) ndigits++; ivalue=atoi(pname+1); // special case %% if ( ( pname != argv[0].a_w.w_symbol-s_name ) ( *(pname+1) == '%' ) ) { *(pdname++)=*(pname++); pname++; continue; } *(pdname++)=(char)ivalue; pname+=ndigits+1; } else if ( !strncmp( pname, \, 1 ) ) // quotes are ignored unless %34 { pname++; } else { *(pdname++)=*(pname++); } } *(pdname)='\0'; x-x_xoffsets[x-x_nbtexts] = (int)argv[1].a_w.w_float; x-x_yoffsets[x-x_nbtexts] = (int)argv[2].a_w.w_float; if ( (argc=4) (argv[3].a_type == A_FLOAT) ) { x-x_r[x-x_nbtexts] = (int)argv[3].a_w.w_float; } if ( (argc=5) (argv[4].a_type == A_FLOAT) ) { x-x_g[x-x_nbtexts] = (int)argv[4].a_w.w_float; } if ( (argc=6) (argv[5].a_type == A_FLOAT) ) { x-x_b[x-x_nbtexts] = (int)argv[5].a_w.w_float; } if ( (argc=7) (argv[6].a_type == A_FLOAT) ) { x-x_angle[x-x_nbtexts] = argv[6].a_w.w_float; } if ( (argc=8) (argv[7].a_type == A_FLOAT) ) { x-x_scroll[x-x_nbtexts] = (int)argv[7].a_w.w_float; } post( pdp_text : added text %s @ %d (r=%d g=%d b=%d), x-x_text_array[x-x_nbtexts], x-x_nbtexts, x-x_r[x-x_nbtexts], x-x_g[x-x_nbtexts], x-x_b[x-x_nbtexts] ); if ( x-x_current ==
[PD] pdp_text stange behaviour
Hi list, i'm working on a patch with two instances of pdp_text object. Two (or more) pdp_text object should work independently from eachother, but this is not totally true, not with the font argument. If I change font type or font size in one of two players, it change on both. I made an example patch with two independent pdp_txt object with independent glx output. But I have same result by put both on the same glx output. Is this a bug? Any solution or workaround? Someone knows anything about? example patch: http://www.estereotips.net/qeve/doc/pdp_text.zip thanks Husk ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list
Re: [PD] pdp_text stange behaviour
ola, it's a limitation here, as we use the imlib library that lets sets the font only globally in your application with : imlib_context_set_font( font ); i don't know any workaround for it. saluti, sevy husk wrote: Hi list, i'm working on a patch with two instances of pdp_text object. Two (or more) pdp_text object should work independently from eachother, but this is not totally true, not with the font argument. If I change font type or font size in one of two players, it change on both. I made an example patch with two independent pdp_txt object with independent glx output. But I have same result by put both on the same glx output. Is this a bug? Any solution or workaround? Someone knows anything about? example patch: http://www.estereotips.net/qeve/doc/pdp_text.zip thanks Husk ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list ___ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management - http://lists.puredata.info/listinfo/pd-list