Fossil SCM

New Pikchr that fixes text positioning on negative thickness lines.

drh 2023-08-23 15:57 trunk
Commit 2bdd36e4adf88b172302697840b29a406552c12055cb75bb9a5bda3ded469622
+4 -3
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -4909,10 +4909,11 @@
49094909
PNum ha1 = 0.0; /* Height of the second "above" row */
49104910
PNum hc = 0.0; /* Height of the center row */
49114911
PNum hb1 = 0.0; /* Height of the first "below" row of text */
49124912
PNum hb2 = 0.0; /* Height of the second "below" row */
49134913
PNum yBase = 0.0;
4914
+ PNum sw = pObj->sw>=0.0 ? pObj->sw : 0;
49144915
int n, i, nz;
49154916
PNum x, y, orig_y, s;
49164917
const char *z;
49174918
PToken *aTxt;
49184919
unsigned allMask = 0;
@@ -4923,11 +4924,11 @@
49234924
n = pObj->nTxt;
49244925
pik_txt_vertical_layout(pObj);
49254926
x = pObj->ptAt.x;
49264927
for(i=0; i<n; i++) allMask |= pObj->aTxt[i].eCode;
49274928
if( pObj->type->isLine ){
4928
- hc = pObj->sw*1.5;
4929
+ hc = sw*1.5;
49294930
}else if( pObj->rad>0.0 && pObj->type->xInit==cylinderInit ){
49304931
yBase = -0.75*pObj->rad;
49314932
}
49324933
if( allMask & TP_CENTER ){
49334934
for(i=0; i<n; i++){
@@ -4968,11 +4969,11 @@
49684969
}
49694970
}
49704971
}
49714972
}
49724973
if( pObj->type->eJust==1 ){
4973
- jw = 0.5*(pObj->w - 0.5*(p->charWidth + pObj->sw));
4974
+ jw = 0.5*(pObj->w - 0.5*(p->charWidth + sw));
49744975
}else{
49754976
jw = 0.0;
49764977
}
49774978
for(i=0; i<n; i++){
49784979
PToken *t = &aTxt[i];
@@ -8142,6 +8143,6 @@
81428143
81438144
81448145
#endif /* PIKCHR_TCL */
81458146
81468147
8147
-#line 8172 "pikchr.c"
8148
+#line 8173 "pikchr.c"
81488149
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -4909,10 +4909,11 @@
4909 PNum ha1 = 0.0; /* Height of the second "above" row */
4910 PNum hc = 0.0; /* Height of the center row */
4911 PNum hb1 = 0.0; /* Height of the first "below" row of text */
4912 PNum hb2 = 0.0; /* Height of the second "below" row */
4913 PNum yBase = 0.0;
 
4914 int n, i, nz;
4915 PNum x, y, orig_y, s;
4916 const char *z;
4917 PToken *aTxt;
4918 unsigned allMask = 0;
@@ -4923,11 +4924,11 @@
4923 n = pObj->nTxt;
4924 pik_txt_vertical_layout(pObj);
4925 x = pObj->ptAt.x;
4926 for(i=0; i<n; i++) allMask |= pObj->aTxt[i].eCode;
4927 if( pObj->type->isLine ){
4928 hc = pObj->sw*1.5;
4929 }else if( pObj->rad>0.0 && pObj->type->xInit==cylinderInit ){
4930 yBase = -0.75*pObj->rad;
4931 }
4932 if( allMask & TP_CENTER ){
4933 for(i=0; i<n; i++){
@@ -4968,11 +4969,11 @@
4968 }
4969 }
4970 }
4971 }
4972 if( pObj->type->eJust==1 ){
4973 jw = 0.5*(pObj->w - 0.5*(p->charWidth + pObj->sw));
4974 }else{
4975 jw = 0.0;
4976 }
4977 for(i=0; i<n; i++){
4978 PToken *t = &aTxt[i];
@@ -8142,6 +8143,6 @@
8142
8143
8144 #endif /* PIKCHR_TCL */
8145
8146
8147 #line 8172 "pikchr.c"
8148
--- extsrc/pikchr.c
+++ extsrc/pikchr.c
@@ -4909,10 +4909,11 @@
4909 PNum ha1 = 0.0; /* Height of the second "above" row */
4910 PNum hc = 0.0; /* Height of the center row */
4911 PNum hb1 = 0.0; /* Height of the first "below" row of text */
4912 PNum hb2 = 0.0; /* Height of the second "below" row */
4913 PNum yBase = 0.0;
4914 PNum sw = pObj->sw>=0.0 ? pObj->sw : 0;
4915 int n, i, nz;
4916 PNum x, y, orig_y, s;
4917 const char *z;
4918 PToken *aTxt;
4919 unsigned allMask = 0;
@@ -4923,11 +4924,11 @@
4924 n = pObj->nTxt;
4925 pik_txt_vertical_layout(pObj);
4926 x = pObj->ptAt.x;
4927 for(i=0; i<n; i++) allMask |= pObj->aTxt[i].eCode;
4928 if( pObj->type->isLine ){
4929 hc = sw*1.5;
4930 }else if( pObj->rad>0.0 && pObj->type->xInit==cylinderInit ){
4931 yBase = -0.75*pObj->rad;
4932 }
4933 if( allMask & TP_CENTER ){
4934 for(i=0; i<n; i++){
@@ -4968,11 +4969,11 @@
4969 }
4970 }
4971 }
4972 }
4973 if( pObj->type->eJust==1 ){
4974 jw = 0.5*(pObj->w - 0.5*(p->charWidth + sw));
4975 }else{
4976 jw = 0.0;
4977 }
4978 for(i=0; i<n; i++){
4979 PToken *t = &aTxt[i];
@@ -8142,6 +8143,6 @@
8143
8144
8145 #endif /* PIKCHR_TCL */
8146
8147
8148 #line 8173 "pikchr.c"
8149
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
cannot compute difference between binary files
11
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
0 annot compute difference between binary files
1
--- extsrc/pikchr.wasm
+++ extsrc/pikchr.wasm
0 annot compute difference between binary files
1

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button