|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef __LP64__
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Toonz includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tvectorimage.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstroke.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "trop.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qsharedmemory></qsharedmemory>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
なぜか tipc.h の
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
template<typename t=""></typename>
|
|
Toshihiro Shimizu |
890ddd |
QDataStream& operator>>(QDataStream& ds, std::vector<t>& vec)</t>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
が T=TThickPoint でインスタンス化されようとして曖昧ですエラーになる
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
//tipc includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tipc.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "t32bitsrv_wrap.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfont.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// Local namespace stuff
|
|
Toshihiro Shimizu |
890ddd |
//**************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QDataStream &operator>>(QDataStream &ds, TThickPoint &p)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return ds >> p.x >> p.y >> p.thick;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void readVImage(TVectorImageP &vi, tipc::Message &msg)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
std::vector<tthickpoint> strokeCPs;</tthickpoint>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Read in all strokes
|
|
Toshihiro Shimizu |
890ddd |
while (!msg.ds().atEnd()) {
|
|
Toshihiro Shimizu |
890ddd |
strokeCPs.clear();
|
|
Toshihiro Shimizu |
890ddd |
msg >> strokeCPs;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
vi->addStroke(new TStroke(strokeCPs));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
vi->group(0, vi->getStrokeCount());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} //namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// TFontManager Private stuff
|
|
Toshihiro Shimizu |
890ddd |
//**************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*
|
|
Toshihiro Shimizu |
890ddd |
The proxied Impl private just caches some data of the actual
|
|
Toshihiro Shimizu |
890ddd |
background counterpart
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
struct TFontManager::Impl {
|
|
Toshihiro Shimizu |
890ddd |
int m_ascender;
|
|
Toshihiro Shimizu |
890ddd |
int m_descender;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Impl() {}
|
|
Toshihiro Shimizu |
890ddd |
~Impl() {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//**************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
// TFontManager Proxied implementation
|
|
Toshihiro Shimizu |
890ddd |
//**************************************************************************
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFontManager::TFontManager()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_pimpl = new TFontManager::Impl();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFontManager::~TFontManager()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
delete m_pimpl;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TFontManager *TFontManager::instance()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
static TFontManager theInstance;
|
|
Toshihiro Shimizu |
890ddd |
return &theInstance;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//!This function is retained from old 32-bit legacy code.
|
|
Toshihiro Shimizu |
890ddd |
//!Its use is now forbidden - use the TFontManager directly instead.
|
|
Toshihiro Shimizu |
890ddd |
TFont *TFontManager::getCurrentFont()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(false);
|
|
Toshihiro Shimizu |
890ddd |
return 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//!\note Throws TFontLibraryLoadingError if fonts could not be loaded
|
|
Toshihiro Shimizu |
890ddd |
void TFontManager::loadFontNames()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Connect to the 32-bit background server process
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTloadFontNames"));
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TFontLibraryLoadingError();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//!\note Throws TFontCreationError if the font could not be created, and
|
|
Toshihiro Shimizu |
890ddd |
//!leaves the old font as current.
|
|
Toshihiro Shimizu |
890ddd |
void TFontManager::setFamily(const wstring family)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTsetFamily") << family);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TFontCreationError();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//!\note Throws TFontCreationError if the font could not be created, and
|
|
Toshihiro Shimizu |
890ddd |
//!leaves the old font as current.
|
|
Toshihiro Shimizu |
890ddd |
void TFontManager::setTypeface(const wstring typeface)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTsetTypeface") << typeface);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TFontCreationError();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Also, store the font's ascender and descender
|
|
Toshihiro Shimizu |
890ddd |
msg >> m_pimpl->m_ascender >> m_pimpl->m_descender;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
wstring TFontManager::getCurrentFamily() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTgetCurrentFamily"));
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Could not get font family");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::wstring family;
|
|
Toshihiro Shimizu |
890ddd |
msg >> family;
|
|
Toshihiro Shimizu |
890ddd |
return family;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
wstring TFontManager::getCurrentTypeface() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTgetCurrentTypeface"));
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Could not get font typeface");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::wstring typeface;
|
|
Toshihiro Shimizu |
890ddd |
msg >> typeface;
|
|
Toshihiro Shimizu |
890ddd |
return typeface;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFontManager::getAllFamilies(vector<wstring> &families) const</wstring>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTgetAllFamilies"));
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Could not get font families");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg >> families;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFontManager::getAllTypefaces(vector<wstring> &typefaces) const</wstring>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTgetAllTypefaces"));
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Could not get font typefaces");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
msg >> typefaces;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFontManager::setVertical(bool vertical)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void TFontManager::setSize(int size)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTsetSize") << size);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Unexpected error");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Also, update ascender and descender
|
|
Toshihiro Shimizu |
890ddd |
msg >> m_pimpl->m_ascender >> m_pimpl->m_descender;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPoint TFontManager::getDistance(wchar_t firstChar, wchar_t secondChar)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTgetDistance") << firstChar << secondChar);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Unexpected error");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPoint d;
|
|
Toshihiro Shimizu |
890ddd |
msg >> d.x >> d.y;
|
|
Toshihiro Shimizu |
890ddd |
return d;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFontManager::getMaxHeight()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_pimpl->m_ascender - m_pimpl->m_descender;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFontManager::getMaxWidth()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
assert(!"not implemented yet");
|
|
Toshihiro Shimizu |
890ddd |
return 100;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TFontManager::hasVertical()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool TFontManager::hasKerning()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFontManager::getLineAscender()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_pimpl->m_ascender;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int TFontManager::getLineDescender()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_pimpl->m_descender;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPoint TFontManager::drawChar(TVectorImageP &outImage, wchar_t charcode, wchar_t nextCode)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTdrawCharVI") << charcode << nextCode);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Unexpected error");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPoint ret;
|
|
Toshihiro Shimizu |
890ddd |
msg >> ret.x >> ret.y;
|
|
Toshihiro Shimizu |
890ddd |
::readVImage(outImage, msg);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return ret;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPoint TFontManager::drawChar(TRasterGR8P &outImage, TPoint &glyphOrigin, wchar_t charcode, wchar_t nextCode)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString shMemId(tipc::uniqueId()), res;
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Invoke the appropriate command
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTdrawCharGR")
|
|
Toshihiro Shimizu |
890ddd |
<< shMemId << charcode << nextCode);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Unexpected error");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDimension dim(0, 0);
|
|
Toshihiro Shimizu |
890ddd |
msg >> dim.lx >> dim.ly;
|
|
Toshihiro Shimizu |
890ddd |
TPoint ret;
|
|
Toshihiro Shimizu |
890ddd |
msg >> ret.x >> ret.y;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Create outImage
|
|
Toshihiro Shimizu |
890ddd |
outImage = TRasterGR8P(dim.lx, dim.ly);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QSharedMemory shmem(shMemId);
|
|
Toshihiro Shimizu |
890ddd |
shmem.attach();
|
|
Toshihiro Shimizu |
890ddd |
shmem.lock();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Copy the returned image to outImage
|
|
Toshihiro Shimizu |
890ddd |
TRasterGR8P ras(dim.lx, dim.ly, dim.lx, (TPixelGR8 *)shmem.data());
|
|
Toshihiro Shimizu |
890ddd |
TRop::copy(outImage, ras);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
shmem.unlock();
|
|
Toshihiro Shimizu |
890ddd |
shmem.detach();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Release the shared segment
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << tipc::clr << QString("$shmem_release") << shMemId);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Unexpected error");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return ret;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//--------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPoint TFontManager::drawChar(TRasterCM32P &outImage, TPoint &glyphOrigin,
|
|
Toshihiro Shimizu |
890ddd |
int inkId, wchar_t charcode, wchar_t nextCode)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QLocalSocket socket;
|
|
Toshihiro Shimizu |
890ddd |
tipc::startSlaveConnection(&socket, t32bitsrv::srvName(), -1, t32bitsrv::srvCmdline());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
tipc::Stream stream(&socket);
|
|
Toshihiro Shimizu |
890ddd |
tipc::Message msg;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QString shMemId(tipc::uniqueId()), res;
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//Invoke the appropriate command
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << QString("$FNTdrawCharCM")
|
|
Toshihiro Shimizu |
890ddd |
<< inkId << shMemId << charcode << nextCode);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Unexpected error");
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TDimension dim(0, 0);
|
|
Toshihiro Shimizu |
890ddd |
msg >> dim.lx >> dim.ly;
|
|
Toshihiro Shimizu |
890ddd |
TPoint ret;
|
|
Toshihiro Shimizu |
890ddd |
msg >> ret.x >> ret.y;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Create outImage
|
|
Toshihiro Shimizu |
890ddd |
outImage = TRasterCM32P(dim.lx, dim.ly);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QSharedMemory shmem(shMemId);
|
|
Toshihiro Shimizu |
890ddd |
shmem.attach();
|
|
Toshihiro Shimizu |
890ddd |
shmem.lock();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Copy the returned image to outImage
|
|
Toshihiro Shimizu |
890ddd |
TRasterCM32P ras(dim.lx, dim.ly, dim.lx, (TPixelCM32 *)shmem.data());
|
|
Toshihiro Shimizu |
890ddd |
TRop::copy(outImage, ras);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
shmem.unlock();
|
|
Toshihiro Shimizu |
890ddd |
shmem.detach();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Release the shared segment
|
|
Toshihiro Shimizu |
890ddd |
stream << (msg << tipc::clr << QString("$shmem_release") << shMemId);
|
|
Toshihiro Shimizu |
890ddd |
if (tipc::readMessage(stream, msg) != "ok")
|
|
Toshihiro Shimizu |
890ddd |
throw TException("Unexpected error");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
return ret;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|