• R/O
  • SSH
  • HTTPS

tsukurimashou: Commit


Commit MetaInfo

Revision168 (tree)
Time2011-11-25 11:28:12
Authormskala

Log Message

kerner improvements, name table, sios/cieuc/chieuch merge, more new jamo

Change Summary

Incremental Difference

--- trunk/kerner/kerner.c (revision 167)
+++ trunk/kerner/kerner.c (revision 168)
@@ -81,7 +81,9 @@
8181
8282 int xmult=10,hullslope=10,hullslope_beyond=3,
8383 num_left_classes=200,num_right_classes=200,
84- kern_round=20,subtable_max=6000;
84+ kern_round=20,subtable_max=5000,
85+ min_class_limit=100,class_limit_mult=3,
86+ left_class_limit=100,right_class_limit=100;
8587 double kern_exponent=3.0,kern_optimal=230.0;
8688
8789 /***********************************************************************/
@@ -340,7 +342,17 @@
340342 void k_means(void) {
341343 int i,j,k;
342344 int pass=0,changed,nearest,dist,tdist,tmp;
345+ int hval;
346+ char *cp;
343347
348+ /* figure out class limits */
349+ left_class_limit=(class_limit_mult*num_glyphs)/num_left_classes;
350+ if (left_class_limit<min_class_limit)
351+ left_class_limit=min_class_limit;
352+ right_class_limit=(class_limit_mult*num_glyphs)/num_right_classes;
353+ if (right_class_limit<min_class_limit)
354+ right_class_limit=min_class_limit;
355+
344356 /* allocate and initialize classes */
345357 left_classes=(CLASS *)obstack_alloc(&obs,
346358 num_left_classes*sizeof(CLASS));
@@ -361,16 +373,28 @@
361373
362374 /* put all glyphs in classes */
363375 for (i=0;i<num_glyphs;i++) {
364- glyphs[i]->left_class=i%num_left_classes;
365- left_classes[i%num_left_classes].class_size++;
376+ hval=0;
377+ for (cp=glyphs[i]->name;*cp;cp++)
378+ hval=((hval<<1)^(hval>>1)^hval^*cp)&0x3FFFFFFF;
379+
380+ if (i<num_left_classes)
381+ glyphs[i]->left_class=i;
382+ else
383+ glyphs[i]->left_class=hval%num_left_classes;
384+ left_classes[glyphs[i]->left_class].class_size++;
366385 for (j=0;j<fbb_h;j++)
367- left_classes[i%num_left_classes].bounds[j]+=
386+ left_classes[glyphs[i]->left_class].bounds[j]+=
368387 (glyphs[i]->right_bounds[j]-glyphs[i]->right_margin);
369388
370- glyphs[i]->right_class=i%num_right_classes;
371- right_classes[i%num_right_classes].class_size++;
389+ hval=((hval<<1)^(hval>>1)^hval)&0x3FFFFFFF;
390+
391+ if (i<num_right_classes)
392+ glyphs[i]->right_class=i;
393+ else
394+ glyphs[i]->right_class=hval%num_right_classes;
395+ right_classes[glyphs[i]->right_class].class_size++;
372396 for (j=0;j<fbb_h;j++)
373- right_classes[i%num_right_classes].bounds[j]+=
397+ right_classes[glyphs[i]->right_class].bounds[j]+=
374398 (glyphs[i]->left_bounds[j]-glyphs[i]->left_margin);
375399 }
376400
@@ -389,7 +413,9 @@
389413 -(left_classes[j].bounds[k]/left_classes[j].class_size);
390414 tdist+=(tmp*tmp);
391415 }
392- if (tdist<dist) {
416+ if ((tdist<dist) &&
417+ ((left_classes[j].class_size<left_class_limit) ||
418+ (j==glyphs[i]->left_class))) {
393419 nearest=j;
394420 dist=tdist;
395421 }
@@ -417,7 +443,9 @@
417443 -(right_classes[j].bounds[k]/right_classes[j].class_size);
418444 tdist+=(tmp*tmp);
419445 }
420- if (tdist<dist) {
446+ if ((tdist<dist) &&
447+ ((right_classes[j].class_size<right_class_limit) ||
448+ (j==glyphs[i]->right_class))) {
421449 nearest=j;
422450 dist=tdist;
423451 }
--- trunk/Makefile.am (revision 167)
+++ trunk/Makefile.am (revision 168)
@@ -345,7 +345,12 @@
345345 's/, +/,/g;s/l___da//g;s/,+/,/g;/\((.*),x___x,(.*)\)/;\
346346 ($$a,$$b)=($$1,$$2);$$a=~s/,+/_/g;$$a=~s/_$$//;$$b=~s/,+/ /g;\
347347 $$_="XLAT_$$a=$$b\n";s/s___e/ /g;s/h___en/-/g;s/([a-z])__/uc($$1)/ge;'
348-makefile-vars.inc: hamlog/config.hl hamlog/select.hl $(HAMLOG_DEPS)
348+jkstyle_xlat_script:=\
349+ 's/, +/,/g;s/l___da//g;s/,+/,/g;/\((.*),x___x,(.*)\)/;\
350+ ($$a,$$b)=($$1,$$2);$$a=~s/,+/_/g;$$a=~s/_$$//;$$b=~s/,+$$//;\
351+ $$_="JKXLAT_$$a=$$b\n";'
352+makefile-vars.inc: \
353+ hamlog/config.hl hamlog/select.hl hamlog/jnames.hl $(HAMLOG_DEPS)
349354 $(TSU_V_HAM)
350355 $(AM_V_at)echo PAGES=`$(HAMLOG) 'P' \
351356 'page_exists(P),want_page(P)' \
@@ -382,6 +387,12 @@
382387 hamlog/config.hl $(mvp)/hamlog/select.hl $(HAMLOG_AFTER) \
383388 | $(PERL) -CSD -pe $(style_xlat_script) \
384389 >> makefile-vars.inc
390+ $(AM_V_at)$(HAMLOG) 'style_jkxlat(F,S,W,P,x___x,FX,SX,WX,PX)' \
391+ 'style_jkxlat(F,S,W,P,x___x,FX,SX,WX,PX)' \
392+ hamlog/config.hl hamlog/jnames.hl \
393+ $(mvp)/hamlog/select.hl $(HAMLOG_AFTER) \
394+ | $(PERL) -CSD -pe $(jkstyle_xlat_script) \
395+ >> makefile-vars.inc
385396
386397 pfdf=$(subst -, ,$(notdir $(basename $(1))))
387398 pfms=$(filter $(DEFAULT_TOK) $(OVERLAY_TOKS),$(call pfdf,$(1)))
@@ -542,10 +553,24 @@
542553 $(AM_V_at)$(PERL) -CSD $(mvp)/tools/make-fea "$(OT_FEATURES)" \
543554 $(mvp)/fea/tsukurimashou.fsc > fea/tsukurimashou.fea
544555
556+define NAME_RECIPE
557+fea/$(subst _,-,$1)-name.fea: fea/.dirstamp tools/make-name
558+ $$(TSU_V_PERL)
559+ $(AM_V_at)$(PERL) -CSD $(mvp)/tools/make-name "$(OT_FEATURES)" \
560+ "$(XLAT_$(word 1,$(subst _,$(space),$1)))" \
561+ "$(XLAT_$1)" \
562+ "$(JKXLAT_$1)" \
563+ > fea/$(subst _,-,$1)-name.fea
564+endef
565+
566+$(foreach style,$(SHORT_STYLES), \
567+ $(eval $(call NAME_RECIPE,$(style))))
568+
545569 define NKOTF_RECIPE
546570 otf/$(subst -,,$(subst $(space),,$(XLAT_$1))).otf: otf/.dirstamp \
547571 sfd/.dirstamp doc/.dirstamp makefile-vars.inc \
548572 pe/assemble-font.pe fea/tsukurimashou.fea tsukurimashou.nam \
573+ fea/$(subst _,-,$1)-name.fea \
549574 $(call PAGEFILES,pfb/,$(1),.pfb)
550575 $(TSU_V_OTF) otf/$(subst -,,$(subst $(space),,$(XLAT_$1))).otf
551576 $(AM_V_at)$(FONTFORGE) pe/assemble-font.pe \
@@ -560,10 +585,14 @@
560585
561586 endef
562587
588+$(foreach style,$(filter-out %_ps,$(SHORT_STYLES)), \
589+ $(eval $(call NKOTF_RECIPE,$(style))))
590+
563591 define KERN_RECIPE
564592 sfd/$(subst _,-,$1).sfd: \
565593 sfd/.dirstamp doc/.dirstamp makefile-vars.inc \
566594 pe/assemble-font.pe fea/tsukurimashou.fea tsukurimashou.nam \
595+ fea/$(subst _,-,$1)-name.fea \
567596 $(call PAGEFILES,pfb/,$(1),.pfb)
568597 $(TSU_V_SFD) sfd/$(subst _,-,$1).sfd
569598 $(AM_V_at)$(FONTFORGE) pe/assemble-font.pe \
@@ -626,9 +655,6 @@
626655
627656 endef
628657
629-$(foreach style,$(filter-out %_ps,$(SHORT_STYLES)), \
630- $(eval $(call NKOTF_RECIPE,$(style))))
631-
632658 $(foreach style,$(filter %_ps,$(SHORT_STYLES)), \
633659 $(eval $(call KERN_RECIPE,$(style))))
634660
Show on old repository browser