|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
Obsolete fribidi_log2visHello,
I'm using fribidi 0.19.2, I was looking at the manpage of fribidi_log2vis, and it said that this function is now obsolete, and advises to use "other functions" instead. The question is, what functions should be used instead ? -- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net) GPG Fingerprint: 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7 _______________________________________________ fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visI may remove the obsolete notice in the future. If your paragraph is one line
of text, you can continue using that function, otherwise, read how it is implemented and that's what you can do. Yes, it's calling four or five functions instead, but that's what you have to do if shaping multi-line paragraphs. behdad On 06/22/2009 06:30 AM, أحمد المحمودي wrote: > Hello, > > I'm using fribidi 0.19.2, I was looking at the manpage of > fribidi_log2vis, and it said that this function is now obsolete, and > advises to use "other functions" instead. The question is, what > functions should be used instead ? > _______________________________________________ fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visOn Mon, Jun 22, 2009 at 01:32:00PM -0400, Behdad Esfahbod wrote:
> I may remove the obsolete notice in the future. If your paragraph > is one line of text, you can continue using that function, ---end quoted text--- Thanks for the info. I have made a small program to test if I understand fribidi right, it is attached with this email. This program works fine as long as: base = FRIBIDI_PAR_LTR; Yet if I set: base = FRIBIDI_PAR_RTL; I don't get anything printed in the printf statement. -- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net) GPG Fingerprint: 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7 _______________________________________________ fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visAttachment?
On 06/22/2009 02:08 PM, أحمد المحمودي wrote: > On Mon, Jun 22, 2009 at 01:32:00PM -0400, Behdad Esfahbod wrote: >> I may remove the obsolete notice in the future. If your paragraph >> is one line of text, you can continue using that function, > ---end quoted text--- > > Thanks for the info. > > I have made a small program to test if I understand fribidi right, it is > attached with this email. > > This program works fine as long as: base = FRIBIDI_PAR_LTR; > > Yet if I set: base = FRIBIDI_PAR_RTL; > > I don't get anything printed in the printf statement. > fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visOn Mon, Jun 22, 2009 at 02:10:35PM -0400, Behdad Esfahbod wrote:
> Attachment? > > On 06/22/2009 02:08 PM, أحمد المحمودي wrote: > >On Mon, Jun 22, 2009 at 01:32:00PM -0400, Behdad Esfahbod wrote: > >>I may remove the obsolete notice in the future. If your paragraph > >>is one line of text, you can continue using that function, > >---end quoted text--- > > > >Thanks for the info. > > > >I have made a small program to test if I understand fribidi right, it is > >attached with this email. > > > >This program works fine as long as: base = FRIBIDI_PAR_LTR; > > > >Yet if I set: base = FRIBIDI_PAR_RTL; > > > >I don't get anything printed in the printf statement. > > -- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net) GPG Fingerprint: 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7 #include <stdio.h> #include <stdlib.h> #include <fribidi/fribidi.h> void main(void) { char instr[]="السلام عليكم bro"; FriBidiChar *us, *out_us; char *outstr; //FriBidiCharType base; FriBidiParType base; int size; size=sizeof(instr); us=(FriBidiChar *) malloc(size*sizeof(FriBidiChar)); out_us=(FriBidiChar *) malloc(size*sizeof(FriBidiChar)); outstr=(char *) malloc(size*sizeof(char)); //base = FRIBIDI_TYPE_N; base = FRIBIDI_PAR_LTR; fribidi_charset_to_unicode(FRIBIDI_CHAR_SET_UTF8, instr, size, us); fribidi_log2vis(us, size, &base, out_us, 0, 0, 0); fribidi_unicode_to_charset(FRIBIDI_CHAR_SET_UTF8, out_us, size, outstr); printf("%s\n", outstr); printf("%d %d\n", size, sizeof(us)); free(us); free(out_us); //free(outstr); } _______________________________________________ fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visYou are not allocating enough for outstr which is UTF8. Try allocating 4
bytes per character. That is, (size * 4). Also, "sizeof(us)" doesn't return what you meant. behdad On 06/22/2009 02:36 PM, أحمد المحمودي wrote: > On Mon, Jun 22, 2009 at 02:10:35PM -0400, Behdad Esfahbod wrote: >> Attachment? >> >> On 06/22/2009 02:08 PM, أحمد المحمودي wrote: >>> On Mon, Jun 22, 2009 at 01:32:00PM -0400, Behdad Esfahbod wrote: >>>> I may remove the obsolete notice in the future. If your paragraph >>>> is one line of text, you can continue using that function, >>> ---end quoted text--- >>> >>> Thanks for the info. >>> >>> I have made a small program to test if I understand fribidi right, it is >>> attached with this email. >>> >>> This program works fine as long as: base = FRIBIDI_PAR_LTR; >>> >>> Yet if I set: base = FRIBIDI_PAR_RTL; >>> >>> I don't get anything printed in the printf statement. >>> > ---end quoted text--- > fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visHello,
On Mon, Jun 22, 2009 at 03:34:41PM -0400, Behdad Esfahbod wrote: > You are not allocating enough for outstr which is UTF8. Try > allocating 4 bytes per character. That is, (size * 4). Thanks, but please notice that instr is also UTF8, and although it consists of 13 characters, yet its size, as returned by sizeof(instr), is 26 ! Anyways I tried your method, yet I still get the problem I mentioned with: base = FRIBIDI_PAR_RTL; That is printf(outstr); shows nothing ! > Also, "sizeof(us)" doesn't return what you meant. Yes, I noticed that it returns the size of pointer type. Well, what I need is to know the size of the string after log2vis, because for example if I got the 2 characters ل & ا after each other, they get translated to a single character, hence the string size decreases. So how do I get the resulting string size ? -- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net) GPG Fingerprint: 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7 _______________________________________________ fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visAre you looking for the string size in characters or in bytes?Hello, On Mon, Jun 22, 2009 at 03:34:41PM -0400, Behdad Esfahbod wrote: Shachar -- Shachar Shemesh Lingnu Open Source Consulting Ltd. http://www.lingnu.com _______________________________________________ fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visHello,
On Tue, Jun 23, 2009 at 05:40:03PM +0300, Shachar Shemesh wrote: > >>Also, "sizeof(us)" doesn't return what you meant. > > > > Yes, I noticed that it returns the size of pointer type. Well, > >what I need is to know the size of the string after log2vis, > >because for example if I got the 2 characters ل & ا after each > >other, they get translated to a single character, hence the > >string size decreases. So how do I get the resulting string size > >? > > > Are you looking for the string size in characters or in bytes? Anyone of them is fine. -- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyID: 0xEDDDA1B7 (@ subkeys.pgp.net) GPG Fingerprint: 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7 _______________________________________________ fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
|
|
Re: Obsolete fribidi_log2visThen allocate enough storage (character count * 4 ought to be enough), do the reordering + shaping, and then use strlen. That will give you number of bytes.Hello, Yes, if you need precise storage, you may need to copy the string again after that, but there is little that can be done about that. There is no way to know how much memory will be needed without actually performing the operations, so the only way to do this without temporary storage is to do it twice. This, typically, costs more than using temporary storage. Shachar -- Shachar Shemesh Lingnu Open Source Consulting Ltd. http://www.lingnu.com _______________________________________________ fribidi mailing list fribidi@... http://lists.freedesktop.org/mailman/listinfo/fribidi |
| Free embeddable forum powered by Nabble | Forum Help |