Commit d6da3da0 authored by Alexey.Golubev's avatar Alexey.Golubev Committed by Alexander.Trofimov

Перемещение директории энжина.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47033 954022d7-b5bf-4e40-9824-e11837661b57
parent b675dc86
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/******************************************************************************/
// SERVICES
/******************************************************************************/
/******************************************************************************/
// bdf
/******************************************************************************/
var FT_SERVICE_ID_BDF = "bdf";
function FT_Service_BDFRec(get_charset_id_,get_property_)
{
this.get_charset_id = get_charset_id_;
this.get_property = get_property_;
}
/******************************************************************************/
// cid
/******************************************************************************/
var FT_SERVICE_ID_CID = "CID";
function FT_Service_CIDRec(get_ros_, get_is_cid_, get_cid_from_glyph_index_)
{
this.get_ros = get_ros_;
this.get_is_cid = get_is_cid_;
this.get_cid_from_glyph_index = get_cid_from_glyph_index_;
}
/******************************************************************************/
// glyph-dict
/******************************************************************************/
var FT_SERVICE_ID_GLYPH_DICT = "glyph-dict";
function FT_Service_GlyphDictRec(get_name_, name_index_)
{
this.get_name = get_name_;
this.name_index = name_index_;
}
/******************************************************************************/
// gxval
/******************************************************************************/
var FT_SERVICE_ID_GX_VALIDATE = "truetypegx-validate";
var FT_SERVICE_ID_CLASSICKERN_VALIDATE = "classickern-validate";
function FT_Service_GXvalidateRec(validate_)
{
this.validate = validate_;
}
function FT_Service_CKERNvalidateRec(validate_)
{
this.validate = validate_;
}
/******************************************************************************/
// kerning
/******************************************************************************/
var FT_SERVICE_ID_KERNING = "kerning";
function FT_Service_KerningRec(get_track_)
{
this.get_track = get_track_;
}
/******************************************************************************/
// multi-masters
/******************************************************************************/
var FT_SERVICE_ID_MULTI_MASTERS = "multi-masters";
function FT_Service_MultiMastersRec(get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_)
{
this.get_mm = get_mm_;
this.set_mm_design = set_mm_design_;
this.set_mm_blend = set_mm_blend_;
this.get_mm_var = get_mm_var_;
this.set_var_design = set_var_design_;
}
/******************************************************************************/
// opentype-validate
/******************************************************************************/
var FT_SERVICE_ID_OPENTYPE_VALIDATE = "opentype-validate";
function FT_Service_OTvalidateRec(validate_)
{
this.validate = validate_;
}
/******************************************************************************/
// pfr-metrics
/******************************************************************************/
var FT_SERVICE_ID_PFR_METRICS = "pfr-metrics";
function FT_Service_PfrMetricsRec(get_metrics_,get_kerning_,get_advance_)
{
this.get_metrics = get_metrics_;
this.get_kerning = get_kerning_;
this.get_advance = get_advance_;
}
/******************************************************************************/
// postscript-font-name
/******************************************************************************/
var FT_SERVICE_ID_POSTSCRIPT_FONT_NAME = "postscript-font-name";
function FT_Service_PsFontNameRec(get_ps_font_name_)
{
this.get_ps_font_name = get_ps_font_name_;
}
/******************************************************************************/
// postscript-cmaps
/******************************************************************************/
var FT_SERVICE_ID_POSTSCRIPT_CMAPS = "postscript-cmaps";
function PS_UniMap()
{
this.unicode;
this.glyph_index;
}
function PS_UnicodesRec()
{
this.cmap;
this.num_maps;
this.maps;
}
function FT_Service_PsCMapsRec(unicode_value_, unicodes_init_,unicodes_char_index_, unicodes_char_next_, macintosh_name_,
adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_)
{
this.unicode_value = unicode_value_;
this.unicodes_init = unicodes_init_;
this.unicodes_char_index = unicodes_char_index_;
this.unicodes_char_next = unicodes_char_next_;
this.macintosh_name = macintosh_name_;
this.adobe_std_strings = adobe_std_strings_;
this.adobe_std_encoding = adobe_std_strings_;
this.adobe_expert_encoding = adobe_expert_encoding_;
}
/******************************************************************************/
// postscript-info
/******************************************************************************/
var FT_SERVICE_ID_POSTSCRIPT_INFO = "postscript-info";
function FT_Service_PsInfoRec(get_font_info_, ps_get_font_extra_, has_glyph_names_,get_font_private_, get_font_value_)
{
this.ps_get_font_info = get_font_info_;
this.ps_get_font_extra = ps_get_font_extra_;
this.ps_has_glyph_names = has_glyph_names_;
this.ps_get_font_private = get_font_private_;
this.ps_get_font_value = get_font_value_;
}
/******************************************************************************/
// sfnt-table
/******************************************************************************/
var FT_SERVICE_ID_SFNT_TABLE = "sfnt-table";
function FT_Service_SFNT_TableRec(load_, get_, info_)
{
this.load_table = load_;
this.get_table = get_;
this.table_info = info_;
}
/******************************************************************************/
// tt-cmaps
/******************************************************************************/
var FT_SERVICE_ID_TT_CMAP = "tt-cmaps";
function TT_CMapInfo()
{
this.language;
this.format;
}
function FT_Service_TTCMapsRec(get_cmap_info_)
{
this.get_cmap_info = get_cmap_info_;
}
/******************************************************************************/
// truetype-engine
/******************************************************************************/
var FT_SERVICE_ID_TRUETYPE_ENGINE = "truetype-engine";
function FT_Service_TrueTypeEngineRec(engine_type_)
{
this.engine_type = engine_type_;
}
/******************************************************************************/
// tt-glyf
/******************************************************************************/
var FT_SERVICE_ID_TT_GLYF = "tt-glyf";
function FT_Service_TTGlyfRec(get_location_)
{
this.get_location = get_location_;
}
/******************************************************************************/
// winfonts
/******************************************************************************/
var FT_SERVICE_ID_WINFNT = "winfonts";
function FT_Service_WinFntRec(get_header_)
{
this.get_header = get_header_;
}
/******************************************************************************/
// xf86
/******************************************************************************/
var FT_SERVICE_ID_XF86_NAME = "xf86-driver-name";
var FT_XF86_FORMAT_TRUETYPE = "TrueType";
var FT_XF86_FORMAT_TYPE_1 = "Type 1";
var FT_XF86_FORMAT_BDF = "BDF";
var FT_XF86_FORMAT_PCF = "PCF";
var FT_XF86_FORMAT_TYPE_42 = "Type 42";
var FT_XF86_FORMAT_CID = "CID Type 1";
var FT_XF86_FORMAT_CFF = "CFF";
var FT_XF86_FORMAT_PFR = "PFR";
var FT_XF86_FORMAT_WINFNT = "Windows FNT";
/******************************************************************************/
function FT_ServiceDescRec(id,data)
{
this.serv_id = id;
this.serv_data = data;
}
function ft_service_list_lookup(service_descriptors,service_id)
{
var c = service_descriptors.length;
for (var i=0;i<c;i++)
{
if (service_descriptors[i].serv_id == service_id)
return service_descriptors[i].serv_data;
}
return null;
}
function FT_FACE_FIND_SERVICE(face, id)
{
var module = face.driver;
if (module.clazz.get_interface)
return module.clazz.get_interface(module, id);
return null;
}
function FT_FACE_FIND_GLOBAL_SERVICE(face, name)
{
return ft_module_get_service(face.driver, name);
}
function ft_module_get_service(module, name)
{
var result = null;
if (module != null)
{
if (null != module.clazz.get_interface)
result = module.clazz.get_interface(module, name);
if (null == result)
{
var modules = module.library.modules;
var count = modules.length;
for (var i = 0;i<count;i++)
{
if (modules[i].clazz.get_interface)
{
result = modules[i].clazz.get_interface(modules[i], name);
if (null != result)
break;
}
}
}
}
return result;
}
function FT_ServiceCache()
{
this.service_POSTSCRIPT_FONT_NAME = null;
this.service_MULTI_MASTERS = null;
this.service_GLYPH_DICT = null;
this.service_PFR_METRICS = null;
this.service_WINFNT = null;
}
\ No newline at end of file
function __init__viewer__(count_fonts)
{
var _len_const_font_infos = g_font_infos.length;
var _len_const_font_files = g_font_files.length;
function new_font_file(index)
{
var ret = new CFontFileLoader("font" + index + ".js");
ret.Status = 0;
ret.stream_index = index;
return ret;
}
for (var i = 0; i < count_fonts; i++)
{
g_font_files[_len_const_font_files + i] = new_font_file(i);
g_map_font_index["font" + i] = _len_const_font_infos + i;
g_font_infos[_len_const_font_infos + i] = new CFontInfo("font" + i, "", FONT_TYPE_EMBEDDED, _len_const_font_files + i,
0, -1, -1, -1, -1, -1, -1);
}
StartViewer();
}
\ No newline at end of file
function CCacheImage() {
// ---------------------------------
this.image = null;
this.image_locked = 0;
this.image_unusedCount = 0;
}
function CCacheManager() {
// ---------------------------------
this.arrayImages = new Array();
this.arrayCount = 0;
this.countValidImage = 5;
// ---------------------------------
this.CheckImagesForNeed = function()
{
for (var i = 0; i < this.arrayCount; ++i)
{
if ((this.arrayImages[i].image_locked == 0) && (this.arrayImages[i].image_unusedCount >= this.countValidImage))
{
delete this.arrayImages[i].image;
this.arrayImages.splice(i, 1);
--i;
--this.arrayCount;
}
}
}
// ---------------------------------
this.UnLock = function(_cache_image)
{
if (null == _cache_image)
return;
_cache_image.image_locked = 0;
_cache_image.image_unusedCount = 0;
// (_cache_image = null) <- !!!!!!!
}
// ---------------------------------
this.Lock = function(_w, _h)
{
for (var i = 0; i < this.arrayCount; ++i)
{
if (this.arrayImages[i].image_locked)
continue;
var _wI = this.arrayImages[i].image.width;
var _hI = this.arrayImages[i].image.height;
if ((_wI == _w) && (_hI == _h))
{
this.arrayImages[i].image_locked = 1;
this.arrayImages[i].image_unusedCount = 0;
this.arrayImages[i].image.ctx.fillStyle = "#ffffff";
this.arrayImages[i].image.ctx.fillRect(0, 0, _w, _h);
return this.arrayImages[i];
}
this.arrayImages[i].image_unusedCount++;
}
this.CheckImagesForNeed();
var index = this.arrayCount;
this.arrayCount++;
this.arrayImages[index] = new CCacheImage();
this.arrayImages[index].image = document.createElement('canvas');
this.arrayImages[index].image.width = _w;
this.arrayImages[index].image.height = _h;
this.arrayImages[index].image.ctx = this.arrayImages[index].image.getContext('2d');
this.arrayImages[index].image.ctx.fillStyle = "#ffffff";
this.arrayImages[index].image.ctx.fillRect(0, 0, _w, _h);
this.arrayImages[index].image_locked = 1;
this.arrayImages[index].image_unusedCount = 0;
return this.arrayImages[index];
}
}
\ No newline at end of file
var arrayImages = new Array();
\ No newline at end of file
var cacheManager = new CCacheManager();
var documentRenderer = new CDocumentRenderer();
function CPage(_w, _h, _pageIndex) {
// ---------------------------------
this.width_mm = _w;
this.height_mm = _h;
this.width_pix = parseInt(_w * koef_mm_to_pix * dZoom);
this.height_pix = parseInt(_h * koef_mm_to_pix * dZoom);
this.pageIndex = _pageIndex;
this.cachedImage = null;
this.indexIteration = 0;
this.timerId = -1;
// ---------------------------------
this.Draw = function(context, xDst, yDst, wDst, hDst, contextW, contextH) {
if (null != this.cachedImage)
{
context.strokeStyle = "#bbbbbb";
context.strokeRect(xDst, yDst, wDst, hDst);
//
context.drawImage(this.cachedImage.image, xDst, yDst, wDst, hDst);
}
else
{
context.fillStyle = "#ffffff";
context.strokeStyle = "#bbbbbb";
context.fillRect(xDst, yDst, wDst, hDst);
context.strokeRect(xDst, yDst, wDst, hDst);
//this.startRendering();
}
}
this.UpdateSize = function(_w, _h) {
this.width_mm = _w;
this.height_mm = _h;
this.width_pix = parseInt(_w * koef_mm_to_pix * dZoom);
this.height_pix = parseInt(_h * koef_mm_to_pix * dZoom);
}
this.startRendering = function()
{
if (null != this.cachedImage)
return;
this.cachedImage = cacheManager.Lock(this.width_pix, this.height_pix);
this.indexIteration = 0;
//this.timerId = setInterval(documentRenderer.drawpage(this), 0);
//var Start = new Date().getTime();
documentRenderer.drawpage(this);
//document.getElementById("Draw").innerHTML = "Draw: " + ((new Date().getTime() - Start) / 1000) + " s";
}
this.startCalculate = function()
{
if (null != this.cachedImage)
return;
this.cachedImage = cacheManager.Lock(this.width_pix, this.height_pix);
this.indexIteration = 0;
//var Start = new Date().getTime();
documentRenderer.drawpage(this);
//document.getElementById("Draw").innerHTML = "Draw: " + ((new Date().getTime() - Start) / 1000) + " s";
}
this.stopRendering = function()
{
if (-1 != this.timerId)
{
clearInterval(this.timerId);
this.timerId = -1;
}
}
this.stopRenderingAttack = function()
{
this.stopRendering();
cacheManager.UnLock(this.cachedImage);
this.cachedImage = null;
}
this.get_graphics = function(){
var g = new CGraphics();
g.init(this.cachedImage.image.ctx,this.width_pix,this.height_pix,this.width_mm,this.height_mm);
g.m_oFontManager = fontManager;
return g;
}
//------------------------------------
}
\ No newline at end of file
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DocumentViewer</title>
<meta http-equiv="X-UA-Compatible" content="IE=9">
<script src="../../FreeType/config.js"></script>
<script src="../../FreeType/services.js"></script>
<script src="../../FreeType/base.js"></script>
<script src="../../FreeType/modules/psnames.js"></script>
<script src="../../FreeType/modules/psaux.js"></script>
<script src="../../FreeType/modules/sfnt.js"></script>
<script src="../../FreeType/modules/render.js"></script>
<script src="../../FreeType/drivers/truetype.js"></script>
<script src="../../FreeType/drivers/cff.js"></script>
<script src="../../FreeType/drivers/t1.js"></script>
<script src="../../FreeType/freetype.js"></script>
<script src="../../FontFile.js"></script>
<script src="../../FontManager.js"></script>
<script src="../const_scripts/drawing/Externals.js"></script>
<script src="../const_scripts/drawing/AllFonts.js"></script>
<script src="fonts/embedded0.js"></script>
<script src="fonts/embedded1.js"></script>
<script type="text/javascript" src="../const_scripts/scripts/images.js"></script>
<script type="text/javascript" src="../const_scripts/scripts/Graphics.js"></script>
<script type="text/javascript" src="documentrenderer.js"></script>
<script type="text/javascript" src="../const_scripts/scripts/cachemanager.js"></script>
<script type="text/javascript" src="../const_scripts/scripts/page.js"></script>
<script type="text/javascript" src="../const_scripts/scripts/main.js"></script>
<script type="text/javascript" src="../const_scripts/run.js"></script>
</head>
<body style="margin:0; padding:0;">
<div id="main_div" style="background-color:#eef0f2; width:100%; height:100%; margin:0; padding:0;">
</div>
<canvas id="wind" style="position:fixed; left:0px; top:0px; margin:0; padding:0;">
Not support browser
</canvas>
<script language="JavaScript">__init__viewer__(2);</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Fonts Test</title>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<script src="FreeType/config.js"></script>
<script src="FreeType/services.js"></script>
<script src="FreeType/base.js"></script>
<script src="FreeType/modules/psnames.js"></script>
<script src="FreeType/modules/psaux.js"></script>
<script src="FreeType/modules/sfnt.js"></script>
<script src="FreeType/modules/render.js"></script>
<script src="FreeType/drivers/truetype.js"></script>
<script src="FreeType/freetype.js"></script>
<script src="FontFile.js"></script>
<script src="FontManager.js"></script>
<script src="FontLoader.js"></script>
<script src="AllFonts.js"></script>
<script src="../Fonts/arial.js"></script>
</head>
<body>
<script language="javascript">
var fontManager = new CFontManager();
fontManager.Initialize();
var font_arial = g_fontsArray[map_font_index["Arial"]];
var Start = new Date().getTime();
font_arial.LoadFont(fontManager, 12, FontStyle.FontStyleRegular, 96, 96);
var End = new Date().getTime();
console.log("time: " + (End - Start) / 1000);
fontManager.LoadString2("a", 0, 0);
while (true)
{
var pGlyph = fontManager.GetNextChar2();
if (null == pGlyph)
break;
}
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment