* Added and implemented AS_GET_FONT_FILE_FORMAT - currently, it returns always
B_TRUETYPE_WINDOWS, though. * possibly returned an uninitialized error code in some BFont methods. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14622 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f3aa24ede7
commit
6f121769ad
@ -123,6 +123,7 @@ enum {
|
||||
AS_GET_TUNED_COUNT,
|
||||
AS_GET_TUNED_INFO,
|
||||
AS_GET_FONT_HEIGHT,
|
||||
AS_GET_FONT_FILE_FORMAT,
|
||||
|
||||
AS_QUERY_FONT_FIXED,
|
||||
AS_SET_FAMILY_AND_STYLE,
|
||||
|
@ -1,41 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: FontFamily.h
|
||||
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
||||
// Description: classes to represent font styles and families
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||
* Axel Dörfler, axeld@pinc-software.de
|
||||
*/
|
||||
#ifndef FONT_FAMILY_H_
|
||||
#define FONT_FAMILY_H_
|
||||
|
||||
|
||||
#include <String.h>
|
||||
#include <Rect.h>
|
||||
#include <Font.h>
|
||||
#include <ObjectList.h>
|
||||
#include <Locker.h>
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
#include "SharedObject.h"
|
||||
|
||||
|
||||
class FontFamily;
|
||||
class ServerFont;
|
||||
|
||||
@ -152,6 +137,8 @@ class FontStyle : public SharedObject, public BLocker {
|
||||
font_height GetHeight(const float& size) const;
|
||||
font_direction Direction() const
|
||||
{ return B_FONT_LEFT_TO_RIGHT; }
|
||||
font_file_format FileFormat() const
|
||||
{ return B_TRUETYPE_WINDOWS; }
|
||||
|
||||
FT_Face GetFTFace() const
|
||||
{ return fFTFace; }
|
||||
|
@ -246,7 +246,7 @@ get_font_style(font_family family, int32 index, font_style *_name,
|
||||
link.AttachString(family);
|
||||
link.Attach<int32>(index);
|
||||
|
||||
int32 status;
|
||||
int32 status = B_ERROR;
|
||||
if (link.FlushWithReply(status) != B_OK
|
||||
|| status != B_OK)
|
||||
return status;
|
||||
@ -382,7 +382,7 @@ BFont::SetFamilyAndStyle(const font_family family, const font_style style)
|
||||
link.Attach<uint16>(0xffff);
|
||||
link.Attach<uint16>(fFace);
|
||||
|
||||
int32 status;
|
||||
int32 status = B_ERROR;
|
||||
if (link.FlushWithReply(status) != B_OK
|
||||
|| status != B_OK)
|
||||
return status;
|
||||
@ -455,7 +455,7 @@ BFont::SetFamilyAndFace(const font_family family, uint16 face)
|
||||
link.Attach<uint16>(0xffff);
|
||||
link.Attach<uint16>(face);
|
||||
|
||||
int32 status;
|
||||
int32 status = B_ERROR;
|
||||
if (link.FlushWithReply(status) != B_OK
|
||||
|| status != B_OK)
|
||||
return status;
|
||||
@ -697,8 +697,22 @@ BFont::Blocks(void) const
|
||||
font_file_format
|
||||
BFont::FileFormat(void) const
|
||||
{
|
||||
// TODO: this will not work until I extend FreeType to handle this kind of call
|
||||
return B_TRUETYPE_WINDOWS;
|
||||
BPrivate::AppServerLink link;
|
||||
link.StartMessage(AS_GET_FONT_FILE_FORMAT);
|
||||
link.Attach<uint16>(fFamilyID);
|
||||
link.Attach<uint16>(fStyleID);
|
||||
|
||||
int32 status;
|
||||
if (link.FlushWithReply(status) != B_OK
|
||||
|| status != B_OK) {
|
||||
// just take a safe bet...
|
||||
return B_TRUETYPE_WINDOWS;
|
||||
}
|
||||
|
||||
uint16 format;
|
||||
link.Read<uint16>(&format);
|
||||
|
||||
return (font_file_format)format;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1252,8 +1252,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
}
|
||||
case AS_GET_FONT_DIRECTION:
|
||||
{
|
||||
FTRACE(("ServerApp %s: AS_GET_FONT_DIRECTION unimplemented\n",
|
||||
Signature()));
|
||||
FTRACE(("ServerApp %s: AS_GET_FONT_DIRECTION\n", Signature()));
|
||||
// Attached Data:
|
||||
// 1) uint16 - family ID
|
||||
// 2) uint16 - style ID
|
||||
@ -1280,6 +1279,35 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
case AS_GET_FONT_FILE_FORMAT:
|
||||
{
|
||||
FTRACE(("ServerApp %s: AS_GET_FONT_FILE_FORMAT\n", Signature()));
|
||||
// Attached Data:
|
||||
// 1) uint16 - family ID
|
||||
// 2) uint16 - style ID
|
||||
|
||||
// Returns:
|
||||
// 1) uint16 font_file_format of font
|
||||
|
||||
int32 familyID, styleID;
|
||||
link.Read<int32>(&familyID);
|
||||
link.Read<int32>(&styleID);
|
||||
|
||||
gFontServer->Lock();
|
||||
|
||||
FontStyle *fontStyle = gFontServer->GetStyle(familyID, styleID);
|
||||
if (fontStyle) {
|
||||
font_direction direction = fontStyle->Direction();
|
||||
|
||||
fLink.StartMessage(B_OK);
|
||||
fLink.Attach<uint16>((uint16)fontStyle->FileFormat());
|
||||
} else
|
||||
fLink.StartMessage(B_BAD_VALUE);
|
||||
|
||||
gFontServer->Unlock();
|
||||
fLink.Flush();
|
||||
break;
|
||||
}
|
||||
case AS_GET_STRING_WIDTHS:
|
||||
{
|
||||
FTRACE(("ServerApp %s: AS_GET_STRING_WIDTHS\n", Signature()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user