339 {
342
345
350
352
355
357
358
359
360#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
361 void* shaper_buf;
362#else
364 void* shaper_buf = &shaper_buf_;
365#endif
366
367
368
369
370
371 FT_TRACE5((
"latin blue zones computation\n"
372 "============================\n"
373 "\n" ));
374
375#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
377#endif
378
380 {
386
387
388#ifdef FT_DEBUG_LEVEL_TRACE
389 {
391
392
394
395 if (
bs->properties )
396 {
398
400 {
402 have_flag = 1;
403 }
405 {
407 have_flag = 1;
408 }
409
411 {
412 if ( have_flag )
415 have_flag = 1;
416 }
417
419 {
420 if ( have_flag )
423 have_flag = 1;
424 }
425
427 {
428 if ( have_flag )
431 }
432
434 }
435
437 }
438#endif
439
440 num_flats = 0;
441 num_rounds = 0;
442 ascender = 0;
443 descender = 0;
444
446 {
449 FT_Int best_point, best_contour_first, best_contour_last;
451
454
455 unsigned int i, num_idx;
456
457#ifdef FT_DEBUG_LEVEL_TRACE
458 const char* p_old;
460#endif
461
462
465
466#ifdef FT_DEBUG_LEVEL_TRACE
469#endif
470
472
473 if ( !num_idx )
474 {
476 continue;
477 }
478
481 else
483
484
485
486 for (
i = 0;
i < num_idx;
i++ )
487 {
490
491
492
494 shaper_buf,
497 &y_offset );
498 if ( glyph_index == 0 )
499 {
501 continue;
502 }
503
506
508 {
509#ifdef FT_DEBUG_LEVEL_TRACE
510 if ( num_idx == 1 )
511 FT_TRACE5((
" U+%04lX contains no (usable) outlines\n",
ch ));
512 else
513 FT_TRACE5((
" component %d of cluster starting with U+%04lX"
514 " contains no (usable) outlines\n",
i,
ch ));
515#endif
516 continue;
517 }
518
519
521 best_point = -1;
522 best_y = 0;
523 best_contour_first = 0;
524 best_contour_last = 0;
525
526 {
530
531
533 {
534 FT_Int old_best_point = best_point;
536
537
539
540
541
542
543
545 continue;
546
549 {
551 {
552 if ( best_point < 0 ||
points[pp].
y > best_y )
553 {
554 best_point = pp;
556 ascender =
FT_MAX( ascender, best_y + y_offset );
557 }
558 else
560 }
561 }
562 else
563 {
565 {
566 if ( best_point < 0 ||
points[pp].
y < best_y )
567 {
568 best_point = pp;
570 descender =
FT_MIN( descender, best_y + y_offset );
571 }
572 else
574 }
575 }
576
577 if ( best_point != old_best_point )
578 {
579 best_contour_first =
first;
580 best_contour_last =
last;
581 }
582 }
583 }
584
585
586
587
588 if ( best_point >= 0 )
589 {
592 FT_Int best_segment_first, best_segment_last;
593 FT_Int best_on_point_first, best_on_point_last;
595
596
597 best_segment_first = best_point;
598 best_segment_last = best_point;
599
601 {
602 best_on_point_first = best_point;
603 best_on_point_last = best_point;
604 }
605 else
606 {
607 best_on_point_first = -1;
608 best_on_point_last = -1;
609 }
610
611
612
613
614 prev = best_point;
616
617 do
618 {
619 if ( prev > best_contour_first )
620 prev--;
621 else
622 prev = best_contour_last;
623
625
626
627 if ( dist > 5 )
629 break;
630
631 best_segment_first = prev;
632
634 {
635 best_on_point_first = prev;
636 if ( best_on_point_last < 0 )
637 best_on_point_last = prev;
638 }
639
640 } while ( prev != best_point );
641
642 do
643 {
644 if (
next < best_contour_last )
646 else
647 next = best_contour_first;
648
650 if ( dist > 5 )
652 break;
653
654 best_segment_last =
next;
655
657 {
658 best_on_point_last =
next;
659 if ( best_on_point_first < 0 )
660 best_on_point_first =
next;
661 }
662
663 }
while (
next != best_point );
664
666 {
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
683
684
686 points[best_segment_first].
x );
687
688 if ( dist < length_threshold &&
689 best_segment_last - best_segment_first + 2 <=
690 best_contour_last - best_contour_first )
691 {
692
694
698
699
700
701
702
705
707
708
709
710 prev = best_point;
711
712 do
713 {
714 if ( prev > best_contour_first )
715 prev--;
716 else
717 prev = best_contour_last;
718
719 if (
points[prev].
x != best_x )
720 break;
721
722 } while ( prev != best_point );
723
724
725 if ( prev == best_point )
726 continue;
727
729
730 first = best_segment_last;
732 hit = 0;
733
734 do
735 {
738
739
740 if ( !hit )
741 {
742
744
745
748 {
751 }
752 else
753 {
754 p_first = -1;
755 p_last = -1;
756 }
757
758 hit = 1;
759 }
760
761 if (
last < best_contour_last )
763 else
764 last = best_contour_first;
765
767 {
768
769 hit = 0;
770 continue;
771 }
772
773
775 if ( dist > 5 )
777 20 * dist )
778 {
779 hit = 0;
780 continue;
781 }
782
784 {
786 if ( p_first < 0 )
788 }
789
792
793 if ( l2r == left2right &&
794 d >= length_threshold )
795 {
796
797
798 do
799 {
800 if (
last < best_contour_last )
802 else
803 last = best_contour_first;
804
808 20 * dist )
809 {
810 if (
last > best_contour_first )
812 else
813 last = best_contour_last;
814 break;
815 }
816
818
821 {
823 if ( p_first < 0 )
825 }
826
827 }
while (
last != best_segment_first );
828
830
831 best_segment_first =
first;
832 best_segment_last =
last;
833
834 best_on_point_first = p_first;
835 best_on_point_last = p_last;
836
837 break;
838 }
839
840 }
while (
last != best_segment_first );
841 }
842 }
843
844
845
846
847
848 best_y += y_offset;
849
850#ifdef FT_DEBUG_LEVEL_TRACE
851 if ( num_idx == 1 )
852 FT_TRACE5((
" U+%04lX: best_y = %5ld",
ch, best_y ));
853 else
854 FT_TRACE5((
" component %d of cluster starting with U+%04lX:"
855 " best_y = %5ld",
i,
ch, best_y ));
856#endif
857
858
859
860
861
862
863
864
865
866 if ( best_on_point_first >= 0 &&
867 best_on_point_last >= 0 &&
869 points[best_on_point_first].
x ) ) >
870 flat_threshold )
872 else
878
880 {
881
883 continue;
884 }
885
887 }
888
890 {
891 if ( best_y > best_y_extremum )
892 {
893 best_y_extremum = best_y;
895 }
896 }
897 else
898 {
899 if ( best_y < best_y_extremum )
900 {
901 best_y_extremum = best_y;
903 }
904 }
905
906 }
907
910 {
911 if ( best_round )
912 rounds[num_rounds++] = best_y_extremum;
913 else
914 flats[num_flats++] = best_y_extremum;
915 }
916
917 }
918
919 if ( num_flats == 0 && num_rounds == 0 )
920 {
921
922
923
924
926 continue;
927 }
928
929
930
931
934
937 blue_shoot = &
blue->shoot.org;
938
940
941 if ( num_flats == 0 )
942 {
943 *blue_ref =
944 *blue_shoot = rounds[num_rounds / 2];
945 }
946 else if ( num_rounds == 0 )
947 {
948 *blue_ref =
949 *blue_shoot = flats[num_flats / 2];
950 }
951 else
952 {
953 *blue_ref = flats [num_flats / 2];
954 *blue_shoot = rounds[num_rounds / 2];
955 }
956
957
958
959
960 if ( *blue_shoot != *blue_ref )
961 {
963 FT_Pos shoot = *blue_shoot;
965
966
969 {
970 *blue_ref =
971 *blue_shoot = ( shoot +
ref ) / 2;
972
973 FT_TRACE5((
" [overshoot smaller than reference,"
974 " taking mean value]\n" ));
975 }
976 }
977
978 blue->ascender = ascender;
979 blue->descender = descender;
980
988
989
990
991
992
993
996
998 " overshoot = %ld\n",
999 *blue_ref, *blue_shoot ));
1000
1001 }
1002
1004
1006 {
1007
1008
1009
1012
1013
1015 blue_sorted[
i] = &axis->
blues[
i];
1016
1017
1019
1020
1022 {
1025
1026#ifdef FT_DEBUG_LEVEL_TRACE
1028#endif
1029
1030
1033 {
1034 a = &blue_sorted[
i]->
shoot.org;
1035#ifdef FT_DEBUG_LEVEL_TRACE
1036 a_is_top = 1;
1037#endif
1038 }
1039 else
1040 a = &blue_sorted[
i]->
ref.org;
1041
1044 b = &blue_sorted[
i + 1]->
shoot.org;
1045 else
1046 b = &blue_sorted[
i + 1]->
ref.org;
1047
1049 {
1052 " adjusting %s %ld to %ld\n",
1053 a_is_top ? "overshoot" : "reference",
1054 blue_sorted[
i] - axis->
blues,
1056 }
1057 }
1058
1060
1061 return 0;
1062 }
1063 else
1064 {
1065
1066
1069
1071
1072
1074 " hinting disabled for this style\n" ));
1075
1077 {
1079 gstyles[
i] = AF_STYLE_NONE_DFLT;
1080 }
1081
1083
1084 return 1;
1085 }
1086 }
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