338 {
341
344
349
351
354
356
357
358
359#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
360 void* shaper_buf;
361#else
363 void* shaper_buf = &shaper_buf_;
364#endif
365
366
367
368
369
370 FT_TRACE5((
"latin blue zones computation\n"
371 "============================\n"
372 "\n" ));
373
374#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ
376#endif
377
379 {
385
386
387#ifdef FT_DEBUG_LEVEL_TRACE
388 {
390
391
393
394 if (
bs->properties )
395 {
397
399 {
401 have_flag = 1;
402 }
404 {
406 have_flag = 1;
407 }
408
410 {
411 if ( have_flag )
414 have_flag = 1;
415 }
416
418 {
419 if ( have_flag )
422 have_flag = 1;
423 }
424
426 {
427 if ( have_flag )
430 }
431
433 }
434
436 }
437#endif
438
439 num_flats = 0;
440 num_rounds = 0;
441 ascender = 0;
442 descender = 0;
443
445 {
448 FT_Int best_point, best_contour_first, best_contour_last;
450
453
454 unsigned int i, num_idx;
455
456#ifdef FT_DEBUG_LEVEL_TRACE
457 const char* p_old;
459#endif
460
461
464
465#ifdef FT_DEBUG_LEVEL_TRACE
468#endif
469
471
472 if ( !num_idx )
473 {
474 FT_TRACE5((
" U+%04lX unavailable\n", ch ));
475 continue;
476 }
477
480 else
482
483
484
485 for (
i = 0;
i < num_idx;
i++ )
486 {
489
490
491
493 shaper_buf,
496 &y_offset );
497 if ( glyph_index == 0 )
498 {
499 FT_TRACE5((
" U+%04lX unavailable\n", ch ));
500 continue;
501 }
502
505
507 {
508#ifdef FT_DEBUG_LEVEL_TRACE
509 if ( num_idx == 1 )
510 FT_TRACE5((
" U+%04lX contains no (usable) outlines\n", ch ));
511 else
512 FT_TRACE5((
" component %d of cluster starting with U+%04lX"
513 " contains no (usable) outlines\n",
i, ch ));
514#endif
515 continue;
516 }
517
518
520 best_point = -1;
521 best_y = 0;
522 best_contour_first = 0;
523 best_contour_last = 0;
524
525 {
529
530
532 {
533 FT_Int old_best_point = best_point;
535
536
538
539
540
541
542
544 continue;
545
548 {
550 {
551 if ( best_point < 0 ||
points[pp].
y > best_y )
552 {
553 best_point = pp;
555 ascender =
FT_MAX( ascender, best_y + y_offset );
556 }
557 else
559 }
560 }
561 else
562 {
564 {
565 if ( best_point < 0 ||
points[pp].
y < best_y )
566 {
567 best_point = pp;
569 descender =
FT_MIN( descender, best_y + y_offset );
570 }
571 else
573 }
574 }
575
576 if ( best_point != old_best_point )
577 {
578 best_contour_first =
first;
579 best_contour_last =
last;
580 }
581 }
582 }
583
584
585
586
587 if ( best_point >= 0 )
588 {
591 FT_Int best_segment_first, best_segment_last;
592 FT_Int best_on_point_first, best_on_point_last;
594
595
596 best_segment_first = best_point;
597 best_segment_last = best_point;
598
600 {
601 best_on_point_first = best_point;
602 best_on_point_last = best_point;
603 }
604 else
605 {
606 best_on_point_first = -1;
607 best_on_point_last = -1;
608 }
609
610
611
612
613 prev = best_point;
615
616 do
617 {
618 if ( prev > best_contour_first )
619 prev--;
620 else
621 prev = best_contour_last;
622
624
625
626 if ( dist > 5 )
628 break;
629
630 best_segment_first = prev;
631
633 {
634 best_on_point_first = prev;
635 if ( best_on_point_last < 0 )
636 best_on_point_last = prev;
637 }
638
639 } while ( prev != best_point );
640
641 do
642 {
643 if (
next < best_contour_last )
645 else
646 next = best_contour_first;
647
649 if ( dist > 5 )
651 break;
652
653 best_segment_last =
next;
654
656 {
657 best_on_point_last =
next;
658 if ( best_on_point_first < 0 )
659 best_on_point_first =
next;
660 }
661
662 }
while (
next != best_point );
663
665 {
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
682
683
685 points[best_segment_first].
x );
686
687 if ( dist < length_threshold &&
688 best_segment_last - best_segment_first + 2 <=
689 best_contour_last - best_contour_first )
690 {
691
693
697
698
699
700
701
704
706
707
708
709 prev = best_point;
710
711 do
712 {
713 if ( prev > best_contour_first )
714 prev--;
715 else
716 prev = best_contour_last;
717
718 if (
points[prev].
x != best_x )
719 break;
720
721 } while ( prev != best_point );
722
723
724 if ( prev == best_point )
725 continue;
726
728
729 first = best_segment_last;
731 hit = 0;
732
733 do
734 {
737
738
739 if ( !hit )
740 {
741
743
744
747 {
750 }
751 else
752 {
753 p_first = -1;
754 p_last = -1;
755 }
756
757 hit = 1;
758 }
759
760 if (
last < best_contour_last )
762 else
763 last = best_contour_first;
764
766 {
767
768 hit = 0;
769 continue;
770 }
771
772
774 if ( dist > 5 )
776 20 * dist )
777 {
778 hit = 0;
779 continue;
780 }
781
783 {
785 if ( p_first < 0 )
787 }
788
791
792 if ( l2r == left2right &&
793 d >= length_threshold )
794 {
795
796
797 do
798 {
799 if (
last < best_contour_last )
801 else
802 last = best_contour_first;
803
807 20 * dist )
808 {
809 if (
last > best_contour_first )
811 else
812 last = best_contour_last;
813 break;
814 }
815
817
820 {
822 if ( p_first < 0 )
824 }
825
826 }
while (
last != best_segment_first );
827
829
830 best_segment_first =
first;
831 best_segment_last =
last;
832
833 best_on_point_first = p_first;
834 best_on_point_last = p_last;
835
836 break;
837 }
838
839 }
while (
last != best_segment_first );
840 }
841 }
842
843
844
845
846
847 best_y += y_offset;
848
849#ifdef FT_DEBUG_LEVEL_TRACE
850 if ( num_idx == 1 )
851 FT_TRACE5((
" U+%04lX: best_y = %5ld", ch, best_y ));
852 else
853 FT_TRACE5((
" component %d of cluster starting with U+%04lX:"
854 " best_y = %5ld",
i, ch, best_y ));
855#endif
856
857
858
859
860
861
862
863
864
865 if ( best_on_point_first >= 0 &&
866 best_on_point_last >= 0 &&
868 points[best_on_point_first].
x ) ) >
869 flat_threshold )
871 else
877
879 {
880
882 continue;
883 }
884
886 }
887
889 {
890 if ( best_y > best_y_extremum )
891 {
892 best_y_extremum = best_y;
894 }
895 }
896 else
897 {
898 if ( best_y < best_y_extremum )
899 {
900 best_y_extremum = best_y;
902 }
903 }
904
905 }
906
909 {
910 if ( best_round )
911 rounds[num_rounds++] = best_y_extremum;
912 else
913 flats[num_flats++] = best_y_extremum;
914 }
915
916 }
917
918 if ( num_flats == 0 && num_rounds == 0 )
919 {
920
921
922
923
925 continue;
926 }
927
928
929
930
933
936 blue_shoot = &
blue->shoot.org;
937
939
940 if ( num_flats == 0 )
941 {
942 *blue_ref =
943 *blue_shoot = rounds[num_rounds / 2];
944 }
945 else if ( num_rounds == 0 )
946 {
947 *blue_ref =
948 *blue_shoot = flats[num_flats / 2];
949 }
950 else
951 {
952 *blue_ref = flats [num_flats / 2];
953 *blue_shoot = rounds[num_rounds / 2];
954 }
955
956
957
958
959 if ( *blue_shoot != *blue_ref )
960 {
962 FT_Pos shoot = *blue_shoot;
964
965
968 {
969 *blue_ref =
970 *blue_shoot = ( shoot +
ref ) / 2;
971
972 FT_TRACE5((
" [overshoot smaller than reference,"
973 " taking mean value]\n" ));
974 }
975 }
976
977 blue->ascender = ascender;
978 blue->descender = descender;
979
987
988
989
990
991
992
995
997 " overshoot = %ld\n",
998 *blue_ref, *blue_shoot ));
999
1000 }
1001
1003
1004
1005
1007 {
1010
1011
1013 blue_sorted[
i] = &axis->
blues[
i];
1014
1015
1017
1018
1020 {
1023
1024#ifdef FT_DEBUG_LEVEL_TRACE
1026#endif
1027
1028
1031 {
1032 a = &blue_sorted[
i]->
shoot.org;
1033#ifdef FT_DEBUG_LEVEL_TRACE
1034 a_is_top = 1;
1035#endif
1036 }
1037 else
1038 a = &blue_sorted[
i]->
ref.org;
1039
1042 b = &blue_sorted[
i + 1]->
shoot.org;
1043 else
1044 b = &blue_sorted[
i + 1]->
ref.org;
1045
1047 {
1050 " adjusting %s %d to %ld\n",
1051 a_is_top ? "overshoot" : "reference",
1052 blue_sorted[
i] - axis->
blues,
1054 }
1055 }
1056 }
1057
1059
1060 return;
1061 }
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