然后文件也打不开----明明文件是存在的,但通过fopen( )函数去打开却打不开,报的错误代代码是下面的.#define EMFILE 24 /* Too many open files */
打开了太多的文件?其实也没打开几个文件的啊!怎么报这个错误呢?内存不足吗?看"no context for glyph 0"这个消息也有内存不够的意思,context是不是有限制数量的?就像WINCE下一样,GDI的context也是有限制的,不能同时打存在太多,内存不足也不像,因为我的程序还是在运行的,不知道为什么想不明白!网上提到这个问题的也少啊!
打开了太多的文件?其实也没打开几个文件的啊!怎么报这个错误呢?内存不足吗?看"no context for glyph 0"这个消息也有内存不够的意思,context是不是有限制数量的?就像WINCE下一样,GDI的context也是有限制的,不能同时打存在太多,内存不足也不像,因为我的程序还是在运行的,不知道为什么想不明白!网上提到这个问题的也少啊!
解决方案 »
- android把变量设置为要跳转的Activity
- Listview的用法
- 如何默认启动自己定制的桌面应用
- 关于ListActivity的设置背景问题
- android 开发环境搭建问题
- 求 android 搜索通讯录中的特殊字符
- 在手机上模拟总是意外停止
- 07-26 00:44:00.727: W/dalvikvm(21098): threadid=1: thread exiting with uncaught
- 高德地图开发中如何加载离线地图
- 百度定位中文乱码问题
- 在自定义thread中handler.sendMessage()执行两次?
- App运行,logcat日志不断输出purging 191k from font cache这样的消息
http://whatis.techtarget.com/definition/0,,sid9_gci212200,00.html
In information technology, a glyph (pronounced GLIHF ; from a Greek word meaning carving) is a graphic symbol that provides the appearance or form for a character . A glyph can be an alphabetic or numeric font or some other symbol that pictures an encoded character.The following is from a document written as background for the Unicode character set standard.An ideal characterization of characters and glyphs and their relationship may be stated as follows:
A character conveys distinctions in meaning or sounds. A character has no intrinsic appearance.
A glyph conveys distinctions in form. A glyph has no intrinsic meaning.
One or more characters may be depicted by one or more glyph representations (instances of an abstract glyph) in a possibly context dependent fashion.
In the Unicode standard, a character is stated to be an abstract entity and not a glyph (some visual representation of a character).
http://www.tot.name/show/3/7/20070528072334.htmnginx出现”too many open files”的解决
http://www.blogkid.net/archives/2531.html
https://code.google.com/p/skia/issues/detail?id=97
Issue 97: skhello does not run in linux
1 person starred this issue and may be notified of changes. Back to list Status: Done
Owner: ----
Closed: Jan 7
Type-Defect
Priority-Medium Sign in to add a comment Reported by [email protected], Jan 6, 2011
Compiled (after a quick fix due to pnt_set_gray_1_2_4_to_8 no longer part of libpng) libskia.a, then compiled skhello (with SKIA_DEBUG=true).skhello compiles ok, but when run from the command line I get:
--- no context for glyph 0
--- no context for glyph 0I installed msttcore fonts into /usr/share/fonts/truetype/msttcorefontsrun skhello again and I now get:
SkFontHost::GetFileName unimplementedI have successfully installed SKIA on MacOSX (unix) with no problems.Comment 1 by [email protected], Jan 6, 2011
Please disregard this post - user error - it is working. Sorry!!!!!!!Comment 2 by project member [email protected], Jan 7, 2011
(No comment was entered for this change.)
Status: Done
► Sign in to add a comment
http://msdn.microsoft.com/en-us/library/dd374393(v=vs.85).aspx
The wglUseFontOutlines function creates a set of display lists, one for each glyph of the currently selected outline font of a device context, for use with the current rendering context. The display lists are used to draw 3-D characters of TrueType fonts. Each display list describes a glyph outline in floating-point coordinates.The run of glyphs begins with thefirstglyph of the font of the specified device context. The em square size of the font, the notional grid size of the original font outline from which the font is fitted, is mapped to 1.0 in the x- and y-coordinates in the display lists. The extrusion parameter sets how much depth the font has in the z direction.Thelpgmfparameter returns a GLYPHMETRICSFLOAT structure that contains information about the placement and orientation of each glyph in a character cell.
http://code.google.com/p/skia/issues/detail?id=64
What steps will reproduce the problem?
1. I download source and build it. I didn't modify anything.
2. I run skhello but it can't work.
3. It die when it run to
"SkScalar width = paint.measureText(text.c_str(), text.size());"What is the expected output? What do you see instead?
已經終止 (I use chinese system, this words means Aborted)What version of the product are you using? On what operating system?
Ubuntu 9.04 skia version 547Please provide any additional information below.
gdb show:
[Thread debugging using libthread_db enabled]
[New Thread 0xb73e56d0 (LWP 18873)]Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb73e56d0 (LWP 18873)]
0xb7753424 in __kernel_vsyscall ()
Screenshot.png
139 KB View Download
Comment 1 by [email protected], Apr 15, 2010 should be fixed in 551
look for skhello.png to be created on success
Comment 2 by [email protected], Apr 15, 2010 (No comment was entered for this change.)Status: Fixed
http://code.google.com/p/skia/source/browse/trunk/tools/skhello.cpp?r=539
#include "SkCanvas.h"
#include "SkGraphics.h"
//#include "SkImageDecoder.h"
#include "SkImageEncoder.h"
//#include "SkStream.h"
#include "SkString.h"
#include "SkTemplates.h"
static void show_help()
{ SkDebugf("usage: skhello [-o out-dir] [-t 'hello']\n default output: skhello.png\n"); } int main (int argc, char * const argv[])
{
SkAutoGraphics ag;
SkString path("skhello.png");
SkString text("Hello");
for (int i = 1; i < argc; i++)
{ if (!strcmp(argv[i], "--help"))
{
show_help();
return 0;
}
//--------------------------------
if (!strcmp(argv[i], "-o"))
{ if (i == argc-1)
{
SkDebugf("ERROR: -o needs a following filename\n"); return -1;
} path.set(argv[i+1]);
i += 1; // skip the out dir name
}
else if (!strcmp(argv[i], "-t"))
{
if (i == argc-1)
{
SkDebugf("ERROR: -t needs a following string\n");
return -1;
} text.set(argv[i+1]);
i += 1; // skip the text string
}
//--------------------------------}
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(SkIntToScalar(30));
SkScalar width = paint.measureText(text.c_str(), text.size());
SkScalar spacing = paint.getFontSpacing();
int w = SkScalarRound(width) + 30;
int h = SkScalarRound(spacing) + 30;
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h);
bitmap.allocPixels();
SkCanvas canvas(bitmap);
canvas.drawColor(SK_ColorWHITE);
paint.setTextAlign(SkPaint::kCenter_Align); canvas.drawText(text.c_str(), text.size(), SkIntToScalar(w)/2, SkIntToScalar(h)*2/3, paint);
SkImageEncoder::EncodeFile(path.c_str(), bitmap, SkImageEncoder::kPNG_Type, 100);
return 0; }
系统的一些进程也会死掉----process com.android.deskclock(pid 1046) has died.(看这个看来是系统内存慢慢不足了,内存机制就把系统的一些进程KILL掉,从而来回收一点内存来用)
最后就输出no context for glyph 0消息了purging 191k from font cache [26 entries]
purging 191k from font cache [26 entries]
purging 191k from font cache [26 entries]
process com.android.deskclock(pid 1046) has died.
---no context for glyph 0
。
最后会出现下面的关键消息
Low memory:no more background processes. Could not create 1032192-byte ashmem mak stack:too many open files
dvmHeapBeginMarkStep failed; aborting
VM aborting
http://www.eoeandroid.com/forum-viewthread-action-printable-tid-27841.html1 skia 项目说明
1.1skia 项目描述
skia 目前已经open source:
path : http://code.google.com/p/skia/
license : apache license2.0
应用项目 : android, chrome
1.2skia 实现的功能
Skia 是一个完整的2D图像库,包括图像,动画,文本绘制功能, RGB(8byte – 32byte)编码(jpeg, png) 和解码功能。(在android2.2 中支持 yuv 的编码解码)。.
1.3代码分析方法
1)下载最新的skia 代码,编译skia.
2)实现 画图,编码,解码 测试程序
3)使用 gdb 单步调试,理解程序运行方式。2 代码组织
Skia 是一个 c++实现的代码库,在android 中以扩展库的形式存在,目录为
external/skia/。
其中文件 include/core/SkCavans.h 中定义了可以使用api.Class SkCanvas:public SkRefnt
{
public:
drawARGB(...)
drawLine(....)
drawBitmap(....)
drawText(....)
}
4个 public函数用于draw 各种数据,这4个函数是 skia 最重要的函数。Class SkImageDecoder{
static bool DecodeMemory(....)
static bool DecodeFile(....)
static bool DecodeStream(....);
}decoder 可以使用的3个decoder的函数对数据进行decoder.
Decoder 支持 jpeg, png, gif 等。
Class SkImageEncoder
{
public:
static bool EncodeFile(....)
static bool EncodeStream(....)
}
encoder 可以使用上面2个函数 对数据进行 encoder, 目前 encoder 只支持输出为
jpeg 和 png. 输入只支持rawdata RGB(8byte – 32byte)编码.如果有硬件的编码和解码器可以通过继承SkImageDecoder和SkImageEncoder来实现硬件编码解码器。
在 android 平台里面 类skImageDecoder_libjpeg.cpp 就是通过继承SkImageDecoder 使用 类库libjpeg 实现 jpeg 的解码。3 使用 skia
Skia 的使用 主要就是用来画图, 它的encoder 和 decoder 接口相当简单,不过由于支持的类型不多,用的并不多,但是单纯的 encoder 和 decoder 还是相当好用的。总体来说 skia 是个相对简单的lib,如何需要画图和简单的encoder 和 decoder 可以使用这个类的public 接口实现。4 android 中如何支持skia
Skia 本身是一个 open source 的 project, 集成于android系统中。所以skia不是android 框架的一部分,不需要实现框架的api来支持skia。
不过skia 同样可以挂接其他的第3方编码解码库或者硬件编解码库。
5 测试程序(画图,encoder, decoder)Test decoder:
1 #include "SkBitmap.h"
2 #include "SkDevice.h"
3 #include "SkPaint.h"
4 #include "SkRect.h"
5 #include "SkImageEncoder.h"
6 #include "SkImageDecoder.h"
7 #include <iostream>
8
9 using namespace std;
10
11 int main()
12 {
13 int ret = -1;
14 SkBitmap bitmap;
15
16 ret = SkImageDecoder::DecodeFile("./snapshot.png", &bitmap);
17 cout<< "get the decode type = "<< bitmap.config() << endl;
18 ret = SkImageEncoder::EncodeFile("new.png", bitmap,
19 //SkImageEncoder::kJPEG_Type,
20 SkImageEncoder::kPNG_Type,
21 /* Quality ranges from 0..100 */ 100);
22 cout<< "encode data to jpg result = "<< ret<< endl;
23 return 0;
24 }test draw and encoder:#include "SkBitmap.h"
2 #include "SkDevice.h"
3 #include "SkPaint.h"
4 #include "SkRect.h"
5 #include "SkImageEncoder.h"
6 #include <iostream>
7
8 using namespace std;
9
10 int main()
11 {
12 int ret = -1;
13 SkBitmap bitmap;
14 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200);
15 bitmap.allocPixels();
16
17 SkCanvas canvas(new SkDevice(bitmap));
18 SkPaint paint;
19
20 paint.setARGB(255, 255, 0, 0);
21 canvas.drawBitmap(bitmap, 25, 25);
22 canvas.drawText("fengguilai", 10, 25, 25, paint);
23 canvas.drawLine(25, 25, 100, 100, paint);
24 canvas.rotate(45);
25 paint.setARGB(255, 0, 255, 0);
26 r.offset(20, 20);
27 canvas.drawRect(r, paint);
28
29 paint.setARGB(255, 0, 0, 255);
30 r.offset(20, 20);
31 canvas.drawRect(r, paint);
32 ret = SkImageEncoder::EncodeFile("snapshot.png", bitmap,
33 //SkImageEncoder::kJPEG_Type,
34 SkImageEncoder::kPNG_Type,
35 /* Quality ranges from 0..100 */ 100);
36 cout<< "encode data to jpg result = "<< ret<< endl;
37 return 0;
38 } 编译:
g++ -I./include -I./include/core -I./include/images -I./include/config -Wall -o <result-name> <sourse-name> out/src/images/SkImageDecoder_libpng.o out/libskia.a -lpng -lfreetype -lpthread -g5 编码解码分析
5.1 注册 编码解码能力
Skia 定义了类template <typename T, typename P> class SkTRegistry : SkNoncopyable
SkTRegistry 内部实现为一个链表。
代码如下:
template <typename T, typename P> class SkTRegistry : SkNoncopyable {
public:
typedef T (*Factory)(P); SkTRegistry(Factory fact) {
#ifdef ANDROID
// work-around for double-initialization bug
{
SkTRegistry* reg = gHead;
while (reg) {
if (reg == this) {
return;
}
reg = reg->fChain;
}
}
#endif
fFact = fact;
fChain = gHead;
gHead = this;
} static const SkTRegistry* Head() { return gHead; } const SkTRegistry* next() const { return fChain; }
Factory factory() const { return fFact; } private:
Factory fFact;
SkTRegistry* fChain; static SkTRegistry* gHead;
}; // The caller still needs to declare an instance of this somewhere
template <typename T, typename P> SkTRegistry<T, P>* SkTRegistry<T, P>::gHead; SkTRegistry(Factory fact) 构造函数,用于注册一个 fact 函数,在使用链表的时候,可以通过节点的fact 获得需要的class, 如一会说到的encoder decoder codec.Ghead 成员变量,永远指向最后一个节点。
Fchain 指向前一个节点。如果是encoder decoder codec, 就可以将自己的factory 函数注册到 这个链表里面,然后当需要创建 encoder decoder codec 实例的时候,loop 这个 list 找到对应的 node, 然后调用factory函数。5.2 encoder 和decoder 的factory
目录 external/skia/src/images中有两个文件:
SkImageDecoder_Factory.cpp
SkImageEncoder_Factory.cpp
两个文件中定义了两个重要的函数:
SkImageDecoder* SkImageDecoder::Factory(SkStream* stream) {
const DecodeReg* curr = DecodeReg::Head();
while (curr) {
SkImageDecoder* codec = curr->factory()(stream);
// we rewind here, because we promise later when we call "decode", that
// the stream will be at its beginning.
stream->rewind();
if (codec) {
return codec;
}
curr = curr->next();
}
return NULL;
} SkImageEncoder* SkImageEncoder::Create(Type t) {
const EncodeReg* curr = EncodeReg::Head();
while (curr) {
SkImageEncoder* codec = curr->factory()(t);
if (codec) {
return codec;
}
curr = curr->next();
}
return NULL;
} 这两个函数就是用来遍历之前的list, 创建encoder decoder 实例。
这里要解释一下,由于通过template,class SkTRegistry 只要是不同的类型,就会有不同的gHeader, 所以不同类型都可以使用 SkTRegistry 而不发生冲突。
5.3 注册 encoder 和 decoder 到 SkTRegistry
目录external/skia/src/images 中有很多类似
SkImageDecoder_lib<*>.cpp的文件,这些文件就是使用第3方的lib 来实现编码和解码的。
在这些文件中都有类似的代码:
(在文件的末尾,并且没有在文件头做声明 且 是 static)
static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(EFactory);
static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(DFactory);
定义在文件的末尾且没有在文件头做声明且是 static,目的只有一个通过 SkTRegistry的构造函数 注册factory 到 list, 这样就告诉android 我有编码 解码 某某格式的能力了。5.4 encoder decoder 使用第3方 lib
通过继承class SkImageEncoder 和 SkImageDecoder 并实现 onEncode 和 onDecode来实现第3方的lib.
http://blog.csdn.net/cuiyan0214/article/details/5964739
WIN DEATH:window{45f968b8 surfaceview paused=false}
process xxx(pid 1168) has died.窗口死了,进程也死了。signal(11)是个什么信号?!
http://archives.postgresql.org/pgsql-novice/2005-09/msg00100.phpSignal 11 is a segmentation fault on Unix systems; this means that the
server process has tried to write to an invalid memory address. It
could be caused by an error in the postgres program itself, or in Java,
or possibly by a hardware fault in your machine's memory.You need to give many more details: which operating system, which
version of PostgreSQL; more details of the command being run - is this
under JBDC? If possible, get a backtrace of the error from the server.
http://www.itpub.net/viewthread.php?tid=1349136&page=1#Process terminated by signal (11)
http://groups.google.com/group/android-ndk/browse_thread/thread/988c0be271cd61fcWhat does this mean? "Command terminated by signal (11: SIGSEGV)"
http://ubuntuforums.org/showthread.php?t=646399
http://www.bitwizard.nl/sig11/ANSWER
Signal 11, or officially know as "segmentation fault",
means that the program accessed a memory location
that was not assigned. That's usually a bug in the program.
So if you're writing your own program, that's the most likely cause.
However, this FAQ will concentrate on the possibilities besides that.