Lines 2618-2630
Link Here
|
2618 |
TextBlock *blk; |
2618 |
TextBlock *blk; |
2619 |
TextLine *line; |
2619 |
TextLine *line; |
2620 |
Unicode *p; |
2620 |
Unicode *p; |
2621 |
Unicode u1, u2; |
2621 |
int m, i, j, k, n, l1, l2; |
2622 |
int m, i, j, k; |
|
|
2623 |
double xStart, yStart, xStop, yStop; |
2622 |
double xStart, yStart, xStop, yStop; |
2624 |
double xMin0, yMin0, xMax0, yMax0; |
2623 |
double xMin0, yMin0, xMax0, yMax0; |
2625 |
double xMin1, yMin1, xMax1, yMax1; |
2624 |
double xMin1, yMin1, xMax1, yMax1; |
2626 |
GBool found; |
2625 |
GBool found; |
2627 |
|
2626 |
UnicodeMap *uMap; |
|
|
2627 |
GString *enc, *str; |
2628 |
char buf[8], ptr[8]; |
2629 |
char u1, u2; |
2630 |
int index[160], linelen=0; |
2631 |
|
2632 |
for (i=0; i < 160; i++) index[i] = 0; |
2628 |
//~ needs to handle right-to-left text |
2633 |
//~ needs to handle right-to-left text |
2629 |
|
2634 |
|
2630 |
if (rawOrder) { |
2635 |
if (rawOrder) { |
Lines 2676-2693
Link Here
|
2676 |
continue; |
2681 |
continue; |
2677 |
} |
2682 |
} |
2678 |
|
2683 |
|
2679 |
// search each position in this line |
2684 |
enc = new GString("Latin1"); |
2680 |
m = line->len; |
2685 |
if (!(uMap = globalParams->getTextEncoding())) { |
2681 |
for (j = 0, p = line->text; j <= m - len; ++j, ++p) { |
2686 |
uMap = globalParams->getUnicodeMap(enc); |
2682 |
|
2687 |
} |
|
|
2688 |
delete enc; |
2689 |
str = new GString(""); |
2690 |
m = line->len; |
2691 |
linelen = m; |
2692 |
index[0] = 0; |
2693 |
for (j = 0, p = line->text; j < m; ++j) { |
2694 |
n = uMap->mapUnicode(p[j], buf, sizeof(buf)); |
2695 |
index[j+1] = index[j] + n; |
2696 |
str->append(buf,n); |
2697 |
} |
2698 |
m = str->getLength(); |
2699 |
for (j = 0; j <= m - len; ++j) { |
2683 |
// compare the strings |
2700 |
// compare the strings |
2684 |
for (k = 0; k < len; ++k) { |
2701 |
for (k = 0; k < len; ++k) { |
2685 |
#if 1 //~ this lowercases Latin A-Z only -- this will eventually be |
2702 |
#if 1 //~ this lowercases Latin A-Z only -- this will eventually be |
2686 |
//~ extended to handle other character sets |
2703 |
//~ extended to handle other character sets |
2687 |
if (p[k] >= 0x41 && p[k] <= 0x5a) { |
2704 |
ptr[0] = 0; |
2688 |
u1 = p[k] + 0x20; |
2705 |
ptr[0] = str->getChar(j+k) & 0xff; |
|
|
2706 |
if (ptr[0] >= 0x41 && ptr[0] <= 0x5a) { |
2707 |
u1 = ptr[0] + 0x20; |
2689 |
} else { |
2708 |
} else { |
2690 |
u1 = p[k]; |
2709 |
u1 = ptr[0]; |
2691 |
} |
2710 |
} |
2692 |
if (s[k] >= 0x41 && s[k] <= 0x5a) { |
2711 |
if (s[k] >= 0x41 && s[k] <= 0x5a) { |
2693 |
u2 = s[k] + 0x20; |
2712 |
u2 = s[k] + 0x20; |
Lines 2699-2731
Link Here
|
2699 |
break; |
2718 |
break; |
2700 |
} |
2719 |
} |
2701 |
} |
2720 |
} |
2702 |
|
|
|
2703 |
// found it |
2721 |
// found it |
2704 |
if (k == len) { |
2722 |
if (k == len) { |
|
|
2723 |
l1 = l2 = 0; |
2724 |
for ( n = 1; n <= linelen; n++) { |
2725 |
if ( (index[n] >= j-1) && (index[n-1] <= j-1)) { |
2726 |
l1 = n; |
2727 |
} |
2728 |
if ( (index[n] >= j+len-1) && (index[n-1] <= j+len-1)) { |
2729 |
l2 = n; |
2730 |
} |
2731 |
|
2732 |
} |
2733 |
len = l2 - l1; |
2705 |
switch (line->rot) { |
2734 |
switch (line->rot) { |
2706 |
case 0: |
2735 |
case 0: |
2707 |
xMin1 = line->edge[j]; |
2736 |
xMin1 = line->edge[l1]; |
2708 |
xMax1 = line->edge[j + len]; |
2737 |
xMax1 = line->edge[l1 + len]; |
2709 |
yMin1 = line->yMin; |
2738 |
yMin1 = line->yMin; |
2710 |
yMax1 = line->yMax; |
2739 |
yMax1 = line->yMax; |
2711 |
break; |
2740 |
break; |
2712 |
case 1: |
2741 |
case 1: |
2713 |
xMin1 = line->xMin; |
2742 |
xMin1 = line->xMin; |
2714 |
xMax1 = line->xMax; |
2743 |
xMax1 = line->xMax; |
2715 |
yMin1 = line->edge[j]; |
2744 |
yMin1 = line->edge[l1]; |
2716 |
yMax1 = line->edge[j + len]; |
2745 |
yMax1 = line->edge[l1 + len]; |
2717 |
break; |
2746 |
break; |
2718 |
case 2: |
2747 |
case 2: |
2719 |
xMin1 = line->edge[j + len]; |
2748 |
xMin1 = line->edge[l1 + len]; |
2720 |
xMax1 = line->edge[j]; |
2749 |
xMax1 = line->edge[l1]; |
2721 |
yMin1 = line->yMin; |
2750 |
yMin1 = line->yMin; |
2722 |
yMax1 = line->yMax; |
2751 |
yMax1 = line->yMax; |
2723 |
break; |
2752 |
break; |
2724 |
case 3: |
2753 |
case 3: |
2725 |
xMin1 = line->xMin; |
2754 |
xMin1 = line->xMin; |
2726 |
xMax1 = line->xMax; |
2755 |
xMax1 = line->xMax; |
2727 |
yMin1 = line->edge[j + len]; |
2756 |
yMin1 = line->edge[l1 + len]; |
2728 |
yMax1 = line->edge[j]; |
2757 |
yMax1 = line->edge[l1]; |
2729 |
break; |
2758 |
break; |
2730 |
} |
2759 |
} |
2731 |
if ((startAtTop || |
2760 |
if ((startAtTop || |
Lines 2742-2747
Link Here
|
2742 |
} |
2771 |
} |
2743 |
} |
2772 |
} |
2744 |
} |
2773 |
} |
|
|
2774 |
delete str; |
2745 |
} |
2775 |
} |
2746 |
} |
2776 |
} |