334 {
337
340
345
347
350
352
353 void* shaper_buf;
354
355
356
357
358
359 FT_TRACE5((
"latin blue zones computation\n"
360 "============================\n"
361 "\n" ));
362
364
366 {
372
373
374#ifdef FT_DEBUG_LEVEL_TRACE
375 {
377
378
380
381 if (
bs->properties )
382 {
384
386 {
388 have_flag = 1;
389 }
391 {
393 have_flag = 1;
394 }
395
397 {
398 if ( have_flag )
401 have_flag = 1;
402 }
403
405 {
406 if ( have_flag )
409 have_flag = 1;
410 }
411
413 {
414 if ( have_flag )
417 }
418
420 }
421
423 }
424#endif
425
426 num_flats = 0;
427 num_rounds = 0;
428 ascender = 0;
429 descender = 0;
430
432 {
435 FT_Int best_point, best_contour_first, best_contour_last;
437
440
441 unsigned int i, num_idx;
442
443#ifdef FT_DEBUG_LEVEL_TRACE
444 const char* p_old;
446#endif
447
448
451
452#ifdef FT_DEBUG_LEVEL_TRACE
455#endif
456
458
459 if ( !num_idx )
460 {
461 FT_TRACE5((
" U+%04lX unavailable\n", ch ));
462 continue;
463 }
464
467 else
469
470
471
472 for (
i = 0;
i < num_idx;
i++ )
473 {
476
477
478
480 shaper_buf,
483 &y_offset );
484 if ( glyph_index == 0 )
485 {
486 FT_TRACE5((
" U+%04lX unavailable\n", ch ));
487 continue;
488 }
489
492
494 {
495#ifdef FT_DEBUG_LEVEL_TRACE
496 if ( num_idx == 1 )
497 FT_TRACE5((
" U+%04lX contains no (usable) outlines\n", ch ));
498 else
499 FT_TRACE5((
" component %d of cluster starting with U+%04lX"
500 " contains no (usable) outlines\n",
i, ch ));
501#endif
502 continue;
503 }
504
505
507 best_point = -1;
508 best_y = 0;
509 best_contour_first = 0;
510 best_contour_last = 0;
511
512 {
516
517
519 {
520 FT_Int old_best_point = best_point;
522
523
525
526
527
528
529
531 continue;
532
535 {
537 {
538 if ( best_point < 0 ||
points[pp].
y > best_y )
539 {
540 best_point = pp;
542 ascender =
FT_MAX( ascender, best_y + y_offset );
543 }
544 else
546 }
547 }
548 else
549 {
551 {
552 if ( best_point < 0 ||
points[pp].
y < best_y )
553 {
554 best_point = pp;
556 descender =
FT_MIN( descender, best_y + y_offset );
557 }
558 else
560 }
561 }
562
563 if ( best_point != old_best_point )
564 {
565 best_contour_first =
first;
566 best_contour_last =
last;
567 }
568 }
569 }
570
571
572
573
574 if ( best_point >= 0 )
575 {
578 FT_Int best_segment_first, best_segment_last;
579 FT_Int best_on_point_first, best_on_point_last;
581
582
583 best_segment_first = best_point;
584 best_segment_last = best_point;
585
587 {
588 best_on_point_first = best_point;
589 best_on_point_last = best_point;
590 }
591 else
592 {
593 best_on_point_first = -1;
594 best_on_point_last = -1;
595 }
596
597
598
599
600 prev = best_point;
602
603 do
604 {
605 if ( prev > best_contour_first )
606 prev--;
607 else
608 prev = best_contour_last;
609
611
612
613 if ( dist > 5 )
615 break;
616
617 best_segment_first = prev;
618
620 {
621 best_on_point_first = prev;
622 if ( best_on_point_last < 0 )
623 best_on_point_last = prev;
624 }
625
626 } while ( prev != best_point );
627
628 do
629 {
630 if (
next < best_contour_last )
632 else
633 next = best_contour_first;
634
636 if ( dist > 5 )
638 break;
639
640 best_segment_last =
next;
641
643 {
644 best_on_point_last =
next;
645 if ( best_on_point_first < 0 )
646 best_on_point_first =
next;
647 }
648
649 }
while (
next != best_point );
650
652 {
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
669
670
672 points[best_segment_first].
x );
673
674 if ( dist < length_threshold &&
675 best_segment_last - best_segment_first + 2 <=
676 best_contour_last - best_contour_first )
677 {
678
680
684
685
686
687
688
691
693
694
695
696 prev = best_point;
697
698 do
699 {
700 if ( prev > best_contour_first )
701 prev--;
702 else
703 prev = best_contour_last;
704
705 if (
points[prev].
x != best_x )
706 break;
707
708 } while ( prev != best_point );
709
710
711 if ( prev == best_point )
712 continue;
713
715
716 first = best_segment_last;
718 hit = 0;
719
720 do
721 {
724
725
726 if ( !hit )
727 {
728
730
731
734 {
737 }
738 else
739 {
740 p_first = -1;
741 p_last = -1;
742 }
743
744 hit = 1;
745 }
746
747 if (
last < best_contour_last )
749 else
750 last = best_contour_first;
751
753 {
754
755 hit = 0;
756 continue;
757 }
758
759
761 if ( dist > 5 )
763 20 * dist )
764 {
765 hit = 0;
766 continue;
767 }
768
770 {
772 if ( p_first < 0 )
774 }
775
778
779 if ( l2r == left2right &&
780 d >= length_threshold )
781 {
782
783
784 do
785 {
786 if (
last < best_contour_last )
788 else
789 last = best_contour_first;
790
794 20 * dist )
795 {
796 if (
last > best_contour_first )
798 else
799 last = best_contour_last;
800 break;
801 }
802
804
807 {
809 if ( p_first < 0 )
811 }
812
813 }
while (
last != best_segment_first );
814
816
817 best_segment_first =
first;
818 best_segment_last =
last;
819
820 best_on_point_first = p_first;
821 best_on_point_last = p_last;
822
823 break;
824 }
825
826 }
while (
last != best_segment_first );
827 }
828 }
829
830
831
832
833
834 best_y += y_offset;
835
836#ifdef FT_DEBUG_LEVEL_TRACE
837 if ( num_idx == 1 )
838 FT_TRACE5((
" U+%04lX: best_y = %5ld", ch, best_y ));
839 else
840 FT_TRACE5((
" component %d of cluster starting with U+%04lX:"
841 " best_y = %5ld",
i, ch, best_y ));
842#endif
843
844
845
846
847
848
849
850
851
852 if ( best_on_point_first >= 0 &&
853 best_on_point_last >= 0 &&
855 points[best_on_point_first].
x ) ) >
856 flat_threshold )
858 else
864
866 {
867
869 continue;
870 }
871
873 }
874
876 {
877 if ( best_y > best_y_extremum )
878 {
879 best_y_extremum = best_y;
881 }
882 }
883 else
884 {
885 if ( best_y < best_y_extremum )
886 {
887 best_y_extremum = best_y;
889 }
890 }
891
892 }
893
896 {
897 if ( best_round )
898 rounds[num_rounds++] = best_y_extremum;
899 else
900 flats[num_flats++] = best_y_extremum;
901 }
902
903 }
904
905 if ( num_flats == 0 && num_rounds == 0 )
906 {
907
908
909
910
912 continue;
913 }
914
915
916
917
920
923 blue_shoot = &
blue->shoot.org;
924
926
927 if ( num_flats == 0 )
928 {
929 *blue_ref =
930 *blue_shoot = rounds[num_rounds / 2];
931 }
932 else if ( num_rounds == 0 )
933 {
934 *blue_ref =
935 *blue_shoot = flats[num_flats / 2];
936 }
937 else
938 {
939 *blue_ref = flats [num_flats / 2];
940 *blue_shoot = rounds[num_rounds / 2];
941 }
942
943
944
945
946 if ( *blue_shoot != *blue_ref )
947 {
949 FT_Pos shoot = *blue_shoot;
951
952
955 {
956 *blue_ref =
957 *blue_shoot = ( shoot +
ref ) / 2;
958
959 FT_TRACE5((
" [overshoot smaller than reference,"
960 " taking mean value]\n" ));
961 }
962 }
963
964 blue->ascender = ascender;
965 blue->descender = descender;
966
974
975
976
977
978
979
982
984 " overshoot = %ld\n",
985 *blue_ref, *blue_shoot ));
986
987 }
988
990
991
992
994 {
997
998
1000 blue_sorted[
i] = &axis->
blues[
i];
1001
1002
1004
1005
1007 {
1010
1011#ifdef FT_DEBUG_LEVEL_TRACE
1013#endif
1014
1015
1018 {
1019 a = &blue_sorted[
i]->
shoot.org;
1020#ifdef FT_DEBUG_LEVEL_TRACE
1021 a_is_top = 1;
1022#endif
1023 }
1024 else
1025 a = &blue_sorted[
i]->
ref.org;
1026
1029 b = &blue_sorted[
i + 1]->
shoot.org;
1030 else
1031 b = &blue_sorted[
i + 1]->
ref.org;
1032
1034 {
1037 " adjusting %s %d to %ld\n",
1038 a_is_top ? "overshoot" : "reference",
1039 blue_sorted[
i] - axis->
blues,
1041 }
1042 }
1043 }
1044
1046
1047 return;
1048 }
af_sort_pos(FT_UInt count, FT_Pos *table)
#define AF_BLUE_STRING_MAX_LEN
#define GET_UTF8_CHAR(ch, p)
#define AF_BLUE_STRINGSET_MAX_LEN
enum AF_Blue_Stringset_ AF_Blue_Stringset
static void af_latin_sort_blue(FT_UInt count, AF_LatinBlue *table)
#define AF_LATIN_IS_X_HEIGHT_BLUE(b)
#define AF_LATIN_IS_TOP_BLUE(b)
#define AF_LATIN_IS_LONG_BLUE(b)
#define AF_LATIN_IS_NEUTRAL_BLUE(b)
#define AF_LATIN_IS_SUB_TOP_BLUE(b)
#define AF_LATIN_BLUE_ADJUSTMENT
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
#define FT_CURVE_TAG(flag)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLsizei const GLfloat * points
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static struct msdos_boot_sector bs
static unsigned __int64 next
AF_Blue_Stringset blue_stringset