diff options
author | Alexey Kryukov <amkryukov@gmail.com> | 2011-02-20 11:43:35 +0300 |
---|---|---|
committer | Alexey Kryukov <amkryukov@gmail.com> | 2011-02-20 11:43:35 +0300 |
commit | 2b62efebd4bd0f4f9f4d598cfab518eaea1029ca (patch) | |
tree | 13e50c0f2f6591f88f504c7d44ae5ad49c8bf56e | |
parent | 6fe88d8f68e43520420e54613a4a7f2c75221871 (diff) |
Sort human-readable stylistic set names (first by feature tag, then by
language) both in the FontInfo dialog and in SFD output.
-rw-r--r-- | fontforge/fontinfo.c | 18 | ||||
-rw-r--r-- | fontforge/sfd.c | 4 |
2 files changed, 19 insertions, 3 deletions
diff --git a/fontforge/fontinfo.c b/fontforge/fontinfo.c index eec058c2..c9fb3cf2 100644 --- a/fontforge/fontinfo.c +++ b/fontforge/fontinfo.c @@ -3487,6 +3487,20 @@ static int GFI_AddOFL(GGadget *g, GEvent *e) { return( true ); } +static int ss_cmp(const void *_md1, const void *_md2) { + const struct matrix_data *md1 = _md1, *md2 = _md2; + + char buf1[20], buf2[20]; + const char *l1, *l2; + + if ( md1[1].u.md_ival == md2[1].u.md_ival ) { + l1 = langname(md1[0].u.md_ival,buf1); + l2 = langname(md2[0].u.md_ival,buf2); +return( strcoll(l1,l2)); + } +return( md1[1].u.md_ival - md2[1].u.md_ival ); +} + static void SSMatrixInit(struct matrixinit *mi,struct gfi_data *d) { SplineFont *sf = d->sf; struct matrix_data *md; @@ -3509,6 +3523,7 @@ static void SSMatrixInit(struct matrixinit *mi,struct gfi_data *d) { md[3*cnt+2].u.md_str = copy(on->name); } } + qsort( md, cnt, 3*sizeof(struct matrix_data), ss_cmp ); mi->matrix_data = md; mi->initial_row_cnt = cnt; } @@ -3935,7 +3950,8 @@ static void StoreSSNames(struct gfi_data *d) { OtfFeatNameListFree(sf->feat_names); sf->feat_names = NULL; - for ( i=0; i<rows; ++i ) { + qsort( strings, rows, 3*sizeof(struct matrix_data), ss_cmp ); + for ( i=rows-1; i>=0; --i ) { if ( strings[3*i+2].u.md_str == NULL ) continue; tag = strings[3*i+1].u.md_ival; diff --git a/fontforge/sfd.c b/fontforge/sfd.c index dde1fd15..25c15d72 100644 --- a/fontforge/sfd.c +++ b/fontforge/sfd.c @@ -1626,10 +1626,10 @@ static void SFDDumpOtfFeatNames(FILE *sfd, SplineFont *sf) { fprintf( sfd, "OtfFeatName: '%c%c%c%c' ", fn->tag>>24, fn->tag>>16, fn->tag>>8, fn->tag ); for ( on=fn->names; on!=NULL; on=on->next ) { - fprintf( sfd, " %d ", on->lang ); + fprintf( sfd, "%d ", on->lang ); SFDDumpUTF7Str(sfd, on->name); - putc('\n',sfd); } + putc('\n',sfd); } } |