parent
ef4cdafb8d
commit
6f8b6633be
1 changed files with 22 additions and 28 deletions
|
@ -712,7 +712,6 @@ class Font {
|
||||||
if(charcode == '\r' || charcode == '\n'){
|
if(charcode == '\r' || charcode == '\n'){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// if does exist already
|
|
||||||
if(glyphs.count(glyphIdentity) != 0){
|
if(glyphs.count(glyphIdentity) != 0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -931,38 +930,33 @@ class Font {
|
||||||
convertContour(curves[i], directions[i], bbs[i], &face->glyph->outline, start, face->glyph->outline.contours[i], emSize);
|
convertContour(curves[i], directions[i], bbs[i], &face->glyph->outline, start, face->glyph->outline.contours[i], emSize);
|
||||||
start = face->glyph->outline.contours[i] + 1;
|
start = face->glyph->outline.contours[i] + 1;
|
||||||
}
|
}
|
||||||
// outmost outline must be clock-wise
|
|
||||||
// then flip direction the deeper we go inside
|
|
||||||
for(int i = 0; i < n_contours; i++){
|
for(int i = 0; i < n_contours; i++){
|
||||||
int insideAnother = 0;
|
if(directions[i] < 0){
|
||||||
for(int j = 0; j < n_contours; j++){
|
bool flip = true;
|
||||||
if(i != j){
|
for(int j = 0; j < n_contours; j++){
|
||||||
bool inside = bbs[j].xMin <= bbs[i].xMin
|
if(i != j){
|
||||||
&& bbs[j].xMax >= bbs[i].xMax
|
bool inside = bbs[j].xMin <= bbs[i].xMin
|
||||||
&& bbs[j].yMin <= bbs[i].yMin
|
&& bbs[j].xMax >= bbs[i].xMax
|
||||||
&& bbs[j].yMax >= bbs[i].yMax;
|
&& bbs[j].yMin <= bbs[i].yMin
|
||||||
if(inside){
|
&& bbs[j].yMax >= bbs[i].yMax;
|
||||||
insideAnother++;
|
if(inside){
|
||||||
|
flip = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if(flip){
|
||||||
bool flip = false;
|
for(BufferCurve & curve : curves[i]){
|
||||||
if((insideAnother % 2 == 0 && directions[i] < 0)
|
float tmp_x = curve.x0;
|
||||||
|| (insideAnother % 2 == 1 && directions[i] > 0)){
|
float tmp_y = curve.y0;
|
||||||
flip = true;
|
curve.x0 = curve.x2;
|
||||||
}
|
curve.y0 = curve.y2;
|
||||||
if(flip){
|
curve.x2 = tmp_x;
|
||||||
for(BufferCurve & curve : curves[i]){
|
curve.y2 = tmp_y;
|
||||||
float tmp_x = curve.x0;
|
}
|
||||||
float tmp_y = curve.y0;
|
std::reverse(curves[i].begin(), curves[i].end());
|
||||||
curve.x0 = curve.x2;
|
|
||||||
curve.y0 = curve.y2;
|
|
||||||
curve.x2 = tmp_x;
|
|
||||||
curve.y2 = tmp_y;
|
|
||||||
}
|
}
|
||||||
std::reverse(curves[i].begin(), curves[i].end());
|
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
bufferCurves.insert(bufferCurves.end(), curves[i].begin(), curves[i].end());
|
bufferCurves.insert(bufferCurves.end(), curves[i].begin(), curves[i].end());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
Loading…
Reference in a new issue