added text scaling according to width
diff --git a/player/js/utils/DataManager.js b/player/js/utils/DataManager.js
index b1944b4..f360d23 100644
--- a/player/js/utils/DataManager.js
+++ b/player/js/utils/DataManager.js
@@ -399,6 +399,7 @@
var totalHeight = 0;
var documentText = documentData.t;
len = documentText.length;
+ var tryagain = false;
for(i=0;i<len;i+=1){
newLineFlag = false;
if(documentText.charAt(i) === ' '){
@@ -438,9 +439,13 @@
break;
}
if(lastSpaceIndex === -1){
- //i -= 1;
- documentText = documentText.substr(0,i) + "\r" + documentText.substr(i);
- len += 1;
+ if(fontSize>minFontSize){
+ tryagain = true;
+ break;
+ }else{
+ documentText = documentText.substr(0,i) + "\r" + documentText.substr(i);
+ len += 1;
+ }
}else {
i = lastSpaceIndex;
documentText = documentText.substr(0,i) + "\r" + documentText.substr(i+1);
@@ -453,7 +458,7 @@
}
}
totalHeight += fontSize;
- if(totalHeight < boxHeight || fontSize<=minFontSize){
+ if(!tryagain && (totalHeight < boxHeight || fontSize<=minFontSize)){
fit = true;
} else {
documentText = documentData.t;