mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
fix
This commit is contained in:
@ -15,6 +15,10 @@ if not base.is_file("./raster.o"):
|
|||||||
|
|
||||||
base.configure_common_apps()
|
base.configure_common_apps()
|
||||||
|
|
||||||
|
# remove previous version
|
||||||
|
if base.is_dir("./deploy"):
|
||||||
|
base.delete_dir("./deploy")
|
||||||
|
base.create_dir("./deploy")
|
||||||
if base.is_dir("./o"):
|
if base.is_dir("./o"):
|
||||||
base.delete_dir("./o")
|
base.delete_dir("./o")
|
||||||
base.create_dir("./o")
|
base.create_dir("./o")
|
||||||
|
|||||||
@ -7,9 +7,6 @@ import json
|
|||||||
base.configure_common_apps()
|
base.configure_common_apps()
|
||||||
|
|
||||||
# remove previous version
|
# remove previous version
|
||||||
if base.is_dir("./deploy"):
|
|
||||||
base.delete_dir("./deploy")
|
|
||||||
base.create_dir("./deploy")
|
|
||||||
if base.is_dir("./o"):
|
if base.is_dir("./o"):
|
||||||
base.delete_dir("./o")
|
base.delete_dir("./o")
|
||||||
base.create_dir("./o")
|
base.create_dir("./o")
|
||||||
@ -25,12 +22,12 @@ if not base.is_dir("emsdk"):
|
|||||||
|
|
||||||
# compile
|
# compile
|
||||||
compiler_flags = ["-O3",
|
compiler_flags = ["-O3",
|
||||||
"-fno-rtti",
|
# "-fno-rtti"
|
||||||
"-Wno-unused-command-line-argument",
|
"-Wno-unused-command-line-argument",
|
||||||
"-s WASM=1",
|
"-s WASM=1",
|
||||||
"-s ALLOW_MEMORY_GROWTH=1",
|
"-s ALLOW_MEMORY_GROWTH=1",
|
||||||
"-s FILESYSTEM=0",
|
"-s FILESYSTEM=0",
|
||||||
"-s ENVIRONMENT='web,worker'"]
|
"-s ENVIRONMENT='web'"]
|
||||||
#"-s LLD_REPORT_UNDEFINED"]
|
#"-s LLD_REPORT_UNDEFINED"]
|
||||||
|
|
||||||
compile_files_array = []
|
compile_files_array = []
|
||||||
|
|||||||
@ -194,34 +194,58 @@
|
|||||||
var reader = new CBinaryReader(buffer, 0, len);
|
var reader = new CBinaryReader(buffer, 0, len);
|
||||||
|
|
||||||
var Line = -1;
|
var Line = -1;
|
||||||
|
var prevY = -1;
|
||||||
while (reader.isValid())
|
while (reader.isValid())
|
||||||
{
|
{
|
||||||
var rec = {};
|
// xps
|
||||||
rec["word"] = reader.readString();
|
if (this.type == 2)
|
||||||
if (this.type == 2)
|
{
|
||||||
{
|
let _fontName = reader.readString();
|
||||||
rec["x"] = 1.015 * reader.readDouble();
|
let _fontSize = reader.readDouble();
|
||||||
rec["y"] = 1.015 * reader.readDouble();
|
let amount = reader.readInt();
|
||||||
}
|
for (var i = 0; i < amount; i++)
|
||||||
else
|
{
|
||||||
{
|
let _X = reader.readDouble();
|
||||||
rec["x"] = reader.readDouble();
|
let _Y = reader.readDouble();
|
||||||
rec["y"] = reader.readDouble();
|
if (_Y != prevY)
|
||||||
}
|
{
|
||||||
rec["w"] = reader.readDouble();
|
if (Line >= 0)
|
||||||
rec["h"] = reader.readDouble();
|
this.pages[pageIndex].Lines[Line].Glyphs.sort((prev, next) => prev.X - next.X);
|
||||||
|
Line++;
|
||||||
Line++;
|
this.pages[pageIndex].Lines.push({ Glyphs : [] });
|
||||||
this.pages[pageIndex].Lines.push({ Glyphs : [] });
|
prevY = _Y;
|
||||||
for (let i = 0; i < _Word.length; i++)
|
}
|
||||||
{
|
let _Char = reader.readInt();
|
||||||
this.pages[pageIndex].Lines[Line].Glyphs.push({
|
this.pages[pageIndex].Lines[Line].Glyphs.push({
|
||||||
X : _X + _W / (_Word.length - 1) * i,
|
fontName : _fontName,
|
||||||
UChar : _Word[i]
|
fontSize : _fontSize,
|
||||||
});
|
X : _X * 1.015,
|
||||||
}
|
Y : _Y * 1.015,
|
||||||
this.pages[pageIndex].Lines[Line].Glyphs[0].Y = _Y + _H;
|
UChar : String.fromCharCode(_Char)
|
||||||
this.pages[pageIndex].Lines[Line].Glyphs[0].fontSize = _H;
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// djvu
|
||||||
|
else
|
||||||
|
{
|
||||||
|
let _Word = reader.readString();
|
||||||
|
let _X = reader.readDouble();
|
||||||
|
let _Y = reader.readDouble();
|
||||||
|
let _W = reader.readDouble();
|
||||||
|
let _H = reader.readDouble();
|
||||||
|
|
||||||
|
Line++;
|
||||||
|
this.pages[pageIndex].Lines.push({ Glyphs : [] });
|
||||||
|
for (let i = 0; i < _Word.length; i++)
|
||||||
|
{
|
||||||
|
this.pages[pageIndex].Lines[Line].Glyphs.push({
|
||||||
|
X : _X + _W / (_Word.length - 1) * i,
|
||||||
|
UChar : _Word[i]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.pages[pageIndex].Lines[Line].Glyphs[0].Y = _Y + _H;
|
||||||
|
this.pages[pageIndex].Lines[Line].Glyphs[0].fontSize = _H;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Module["_free"](glyphs);
|
Module["_free"](glyphs);
|
||||||
@ -246,16 +270,8 @@
|
|||||||
{
|
{
|
||||||
var rec = {};
|
var rec = {};
|
||||||
rec["link"] = reader.readString();
|
rec["link"] = reader.readString();
|
||||||
if (this.type == 2)
|
rec["x"] = (this.type == 2 ? 1.015 : 1) * reader.readDouble();
|
||||||
{
|
rec["y"] = (this.type == 2 ? 1.015 : 1) * reader.readDouble();
|
||||||
rec["x"] = 1.015 * reader.readDouble();
|
|
||||||
rec["y"] = 1.015 * reader.readDouble();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rec["x"] = reader.readDouble();
|
|
||||||
rec["y"] = reader.readDouble();
|
|
||||||
}
|
|
||||||
rec["w"] = reader.readDouble();
|
rec["w"] = reader.readDouble();
|
||||||
rec["h"] = reader.readDouble();
|
rec["h"] = reader.readDouble();
|
||||||
res.push(rec);
|
res.push(rec);
|
||||||
@ -282,16 +298,9 @@
|
|||||||
while (reader.isValid())
|
while (reader.isValid())
|
||||||
{
|
{
|
||||||
var rec = {};
|
var rec = {};
|
||||||
rec["page"] = reader.readInt();
|
rec["page"] = reader.readInt();
|
||||||
rec["level"] = reader.readInt();
|
rec["level"] = reader.readInt();
|
||||||
if (this.type == 2)
|
rec["y"] = reader.readDouble();
|
||||||
{
|
|
||||||
rec["y"] = reader.readDouble();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rec["y"] = reader.readInt();
|
|
||||||
}
|
|
||||||
rec["description"] = reader.readString();
|
rec["description"] = reader.readString();
|
||||||
res.push(rec);
|
res.push(rec);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -353,7 +353,7 @@ void getBookmars(const GP<DjVmNav>& nav, int& pos, int count, NSWasm::CData& out
|
|||||||
{
|
{
|
||||||
out.AddInt(nPage);
|
out.AddInt(nPage);
|
||||||
out.AddInt(level);
|
out.AddInt(level);
|
||||||
out.AddInt(0); // Y position
|
out.AddDouble(0.0);
|
||||||
GUTF8String description = gpBookMark->displayname;
|
GUTF8String description = gpBookMark->displayname;
|
||||||
out.WriteString((BYTE*)description.getbuf(), description.length());
|
out.WriteString((BYTE*)description.getbuf(), description.length());
|
||||||
}
|
}
|
||||||
@ -434,14 +434,10 @@ BYTE* CDjVuFileImplementation::GetPageGlyphs(int nPageIndex, const int& nRasterW
|
|||||||
|
|
||||||
std::string sText = U_TO_UTF8(csWord);
|
std::string sText = U_TO_UTF8(csWord);
|
||||||
oRes.WriteString((BYTE*)sText.c_str(), sText.length());
|
oRes.WriteString((BYTE*)sText.c_str(), sText.length());
|
||||||
std::string sX = std::to_string(arrCoords[0] * dKoefX);
|
oRes.AddDouble(arrCoords[0] * dKoefX);
|
||||||
oRes.WriteString((BYTE*)sX.c_str(), sX.length());
|
oRes.AddDouble(arrCoords[3] * dKoefY);
|
||||||
std::string sY = std::to_string(arrCoords[3] * dKoefY);
|
oRes.AddDouble((arrCoords[2] - arrCoords[0]) * dKoefX);
|
||||||
oRes.WriteString((BYTE*)sY.c_str(), sY.length());
|
oRes.AddDouble((arrCoords[1] - arrCoords[3]) * dKoefY);
|
||||||
std::string sW = std::to_string((arrCoords[2] - arrCoords[0]) * dKoefX);
|
|
||||||
oRes.WriteString((BYTE*)sW.c_str(), sW.length());
|
|
||||||
std::string sH = std::to_string((arrCoords[1] - arrCoords[3]) * dKoefY);
|
|
||||||
oRes.WriteString((BYTE*)sH.c_str(), sH.length());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -722,8 +722,7 @@ namespace XPS
|
|||||||
|
|
||||||
std::string sFontName = U_TO_UTF8(m_pFontManager->GetName());
|
std::string sFontName = U_TO_UTF8(m_pFontManager->GetName());
|
||||||
m_pGlyphs->WriteString((BYTE*)sFontName.c_str(), sFontName.length());
|
m_pGlyphs->WriteString((BYTE*)sFontName.c_str(), sFontName.length());
|
||||||
std::string sFontSize = std::to_string(dFontSize * pdA + pdE);
|
m_pGlyphs->AddDouble(dFontSize * pdA + pdE);
|
||||||
m_pGlyphs->WriteString((BYTE*)sFontSize.c_str(), sFontSize.length());
|
|
||||||
m_pGlyphs->AddInt(unUtf16Len);
|
m_pGlyphs->AddInt(unUtf16Len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -763,10 +762,8 @@ namespace XPS
|
|||||||
double _dY = dYorigin;
|
double _dY = dYorigin;
|
||||||
oTransform.TransformPoint(_dX, _dY);
|
oTransform.TransformPoint(_dX, _dY);
|
||||||
|
|
||||||
std::string sX = std::to_string(_dX);
|
m_pGlyphs->AddDouble(_dX);
|
||||||
m_pGlyphs->WriteString((BYTE*)sX.c_str(), sX.length());
|
m_pGlyphs->AddDouble(_dY);
|
||||||
std::string sY = std::to_string(_dY);
|
|
||||||
m_pGlyphs->WriteString((BYTE*)sY.c_str(), sY.length());
|
|
||||||
m_pGlyphs->AddInt(oEntry.nUnicode);
|
m_pGlyphs->AddInt(oEntry.nUnicode);
|
||||||
m_pGlyphs->WriteLen();
|
m_pGlyphs->WriteLen();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user