public int sceFontGetFontInfo(FontHandle FontHandle, FontInfo *FontInfo) { FontInfo[0] = new FontInfo() { }; return(0); }
public void SetGlyphToPath(FontHandle font, uint glyphIndex) { PathHandle path = PathHandle.Invalid; if (segments.Count != 0) { byte[] segmentBytes = segments.Cast <byte>().ToArray(); float[] coordsFloats = coords.ToArray(); path = vg.CreatePath( Constants.VG_PATH_FORMAT_STANDARD, PathDatatype.VG_PATH_DATATYPE_F, 1.0f / 2048, 0.0f, segmentBytes.Length, coordsFloats.Length, PathCapabilities.VG_PATH_CAPABILITY_ALL ); vg.AppendPathData(path, segmentBytes, coordsFloats); } var origin = new float[] { 0.0f, 0.0f }; vg.SetGlyphToPath(font, glyphIndex, path, false, origin, escapement); if (path != PathHandle.Invalid) { vg.DestroyPath(path); } }
public VGFont(IOpenVG vg, FontHandle fontHandle, Dictionary <uint, float[]> escapements, float height) { this.vg = vg; this.fontHandle = fontHandle; this.escapements = escapements; Height = height; }
public int sceFontGetCharGlyphImage_Clip(FontHandle FontHandle, ushort CharCode, GlyphImage* GlyphImagePointer, int ClipX, int ClipY, int ClipWidth, int ClipHeight) { var Font = Fonts.Get(FontHandle); var Glyph = Font.GetGlyph(CharCode); var Face = Glyph.Face; var PixelFormat = GlyphImagePointer->PixelFormat; var Buffer = PspMemory.PspAddressToPointerSafe(GlyphImagePointer->Buffer); var BufferHeight = GlyphImagePointer->BufferHeight; var BufferWidth = GlyphImagePointer->BufferWidth; var Position = GlyphImagePointer->Position; var GlyphBitmap = Face.GetBitmap(); var OutputBitmap = new PspBitmap(PixelFormat, (int)BufferWidth, (int)BufferHeight, (byte*)Buffer); try { for (int y = 0; y < ClipHeight; y++) { for (int x = 0; x < ClipWidth; x++) { //Console.WriteLine(); OutputBitmap.SetPixel(x, y, new OutputPixel(GlyphBitmap.GetPixel(x + ClipX, y + ClipY))); //OutputBitmap.SetPixel(x, y, new OutputPixel(Color.Red)); } } } catch (Exception Exception) { Console.Error.WriteLine(Exception); } //for (int n = 0; n < ) //Console.Error.WriteLine("'{0}': {1}", (char)CharCode, Glyph); //throw (new NotImplementedException()); return 0; }
public int sceFontGetCharGlyphImage_Clip(FontHandle FontHandle, ushort CharCode, ref GlyphImage GlyphImage, int ClipX, int ClipY, int ClipWidth, int ClipHeight) { try { var Font = Fonts.Get(FontHandle); var Glyph = Font.GetGlyph(CharCode); var CharInfo = Font.GetCharInfo(CharCode); var Face = Glyph.Face; var PixelFormat = GlyphImage.PixelFormat; var Buffer = PspMemory.PspAddressToPointerSafe(GlyphImage.Buffer); var BufferHeight = GlyphImage.BufferHeight; var BufferWidth = GlyphImage.BufferWidth; var BytesPerLine = GlyphImage.BytesPerLine; var Position = GlyphImage.Position; var GlyphBitmap = Face.GetBitmap(); var OutputBitmap = new FontBitmap((byte*)Buffer, PixelFormat, (int)BufferWidth, (int)BufferHeight, BytesPerLine); Console.WriteLine( "sceFontGetCharGlyphImage_Clip({0}, ({1}, {2})-({3}, {4}) : {5}) : {6}", CharCode, ClipX, ClipY, ClipWidth, ClipHeight, PixelFormat, Position ); ClipWidth = Math.Min(ClipWidth, BufferWidth - ClipX); ClipHeight = Math.Min(ClipHeight, BufferHeight - ClipY); ClipWidth = Math.Min(ClipWidth, GlyphBitmap.Width - ClipX); ClipHeight = Math.Min(ClipHeight, GlyphBitmap.Height - ClipY); try { for (int y = 0; y < ClipHeight; y++) { for (int x = 0; x < ClipWidth; x++) { //Console.WriteLine(); var Pixel = GlyphBitmap.GetPixel(x + ClipX, y + ClipY); OutputBitmap.SetPixel(x + (int)Position.X, y + (int)Position.Y, new OutputPixel(Pixel)); //Console.Write(Pixel.R > 0x7F ? "X" : "."); //OutputBitmap.SetPixel(x, y, new OutputPixel(Color.Red)); } //Console.WriteLine(""); } } catch (Exception Exception) { Console.Error.WriteLine(Exception); } //for (int n = 0; n < ) //Console.Error.WriteLine("'{0}': {1}", (char)CharCode, Glyph); //throw (new NotImplementedException()); return 0; } catch (Exception Exception) { Console.Error.WriteLine(Exception); return -1; } }
/// <summary> /// This method retrieves the geometry for a formatted cluster. /// </summary> /// <param name="clusterIndex"> This parameter indicates the formatted cluster index. </param> /// <param name="bidiLevel"> This parameter indicates the bidi level of the cluster. </param> /// <param name="font"> This parameter references the font for the cluster. </param> /// <param name="input"> This parameter references the formatted text output. </param> /// <returns> This method returns the geometry for the formatted cluster if available; otherwise, this method returns <c>null</c>. </returns> public Geometry Retrieve(int clusterIndex, byte bidiLevel, FontHandle font, FormatterSink input) { Contract.Requires(clusterIndex >= 0); Contract.Requires(font != null); Contract.Requires(input != null); FormattedCluster cluster = input.Clusters[clusterIndex]; ResizeInternalBuffers(cluster.Glyphs.Length); int index = 0; foreach(int itemIndex in cluster.Glyphs) { _GlyphAdvances[index] = cluster.Region.Width; _GlyphIndices[index] = input.Glyphs[itemIndex].Index; _GlyphOffsets[index] = input.Glyphs[itemIndex].Offset; ++index; } TextGeometryKey key; key.Advances = _GlyphAdvances; key.Indices = _GlyphIndices; key.Offsets = _GlyphOffsets; Dictionary<TextGeometryKey, Geometry> cacheForFont; if(_Cache.TryGetValue(font, out cacheForFont)) { Geometry result; if(cacheForFont.TryGetValue(key, out result)) { return result; } } else { cacheForFont = new Dictionary<TextGeometryKey, Geometry>(); _Cache.Add(font, cacheForFont); } Geometry geometry = _Sink.CreateGeometry(key, bidiLevel, font); TextGeometryKey newKey; newKey.Advances = (float[])key.Advances.Clone(); newKey.Indices = (short[])key.Indices.Clone(); newKey.Offsets = (GlyphOffset[])key.Offsets.Clone(); cacheForFont.Add(newKey, geometry); return geometry; }
public void DrawGlyphs(FontHandle font, uint glyphCount, byte[] utf32Text, PaintMode paintModes, bool allowAutoHinting) { unsafe { fixed(byte *bytes = utf32Text) { vgDrawGlyphs(font, glyphCount, (uint *)bytes, null, null, (uint)paintModes, allowAutoHinting ? 1U : 0); } } }
public void DrawGlyphs(FontHandle font, uint[] glyphIndices, PaintMode paintModes, bool allowAutoHinting) { unsafe { fixed(uint *p = glyphIndices) { vgDrawGlyphs(font, (uint)glyphIndices.Length, p, null, null, (uint)paintModes, allowAutoHinting ? 1U : 0); } } }
public void DrawGlyphString(FontHandle font, string text, PaintMode paintModes, bool allowAutoHinting) { unsafe { ReadOnlySpan <char> chars = text.AsSpan(); int byteCount = System.Text.Encoding.UTF32.GetByteCount(chars); byte *bytes = stackalloc byte[byteCount]; System.Text.Encoding.UTF32.GetBytes(chars, new Span <byte>(bytes, byteCount)); vgDrawGlyphs(font, (uint)text.Length, (uint *)bytes, null, null, (uint)paintModes, allowAutoHinting ? 1U : 0); } }
private void ClearFont() { _font = null; _boldfont = null; _underlinefont = null; _boldunderlinefont = null; _japaneseFont = null; _japaneseBoldfont = null; _japaneseUnderlinefont = null; _japaneseBoldunderlinefont = null; }
public void SetGlyphToImage(FontHandle font, uint glyphIndex, ImageHandle image, float[] origin, float[] escapement) { unsafe { float *op = stackalloc float[2]; float *ep = stackalloc float[2]; op[0] = origin[0]; op[1] = origin[1]; ep[0] = escapement[0]; ep[1] = escapement[1]; vgSetGlyphToImage(font, glyphIndex, image, op, ep); } }
public void DrawText(FontHandle textFont, uint glyphCount, byte[] utf32Text, PaintMode paintModes, bool allowAutoHinting, float size) { unsafe { int mm = matrixMode; // Get current matrix: float *m = stackalloc float[9]; vgGetMatrix(m); // Switch to glyph matrix if not already: if (mm != (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE) { vgSeti(ParamType.VG_MATRIX_MODE, (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE); vgLoadMatrix(m); } // Render text: //vgScale(size, size); float *origin = stackalloc float[2]; origin[0] = 0f; origin[1] = 0f; vgSetfv(ParamType.VG_GLYPH_ORIGIN, 2, origin); fixed(byte *bytes = utf32Text) { // default: vgDrawGlyphs(textFont, glyphCount, (uint *)bytes, null, null, (uint)paintModes, 0U); // paintModes = 0 still renders glyphs! //vgDrawGlyphs(textFont, glyphCount, (uint*)bytes, null, null, (uint)0, 0U); //uint* p = (uint*)bytes; //for (uint i = 0; i < glyphCount; i++, p++) //{ // vgDrawGlyph(textFont, *p++, (uint)paintModes, 0U); //} } // Restore matrix mode: if (mm != (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE) { // TODO: restore glyph matrix before switching back? vgSeti(ParamType.VG_MATRIX_MODE, mm); } // Restore old matrix: vgLoadMatrix(m); } }
public int sceFontGetCharGlyphImage(FontHandle FontHandle, ushort CharCode, GlyphImage* GlyphImagePointer) { var Font = Fonts.Get(FontHandle); var CharInfo = Font.GetCharInfo(CharCode); return sceFontGetCharGlyphImage_Clip( FontHandle, CharCode, GlyphImagePointer, //(int)CharInfo.BitmapLeft, //(int)CharInfo.BitmapTop, 0, 0, (int)CharInfo.BitmapWidth, (int)CharInfo.BitmapHeight ); }
public int sceFontGetCharInfo(FontHandle FontHandle, ushort CharCode, ref FontCharInfo FontCharInfoPointer) { try { var Font = Fonts.Get(FontHandle); FontCharInfoPointer = Font.GetCharInfo(CharCode); Console.WriteLine("sceFontGetCharInfo({0}) : {1}", CharCode, FontCharInfoPointer); return 0; } catch (Exception Exception) { Console.Error.WriteLine(Exception); return -1; } }
private void Init(CommonOptions opt) { _fontName = opt.FontName; _japaneseFontName = opt.JapaneseFontName; _fontSize = opt.FontSize; _useClearType = opt.UseClearType; _japaneseFont = _font = null; _esColorSet = (EscapesequenceColorSet)opt.ESColorSet.Clone(); _forecolor = opt.TextColor; _bgcolor = opt.BGColor; _bgbrush = _brush = null; _backgroundImageFileName = opt.BackgroundImageFileName; _imageLoadIsAttempted = false; _imageStyle = opt.ImageStyle; }
/// <summary> /// <ja>コピーして作成します。</ja> /// <en>Initializes with another instance.</en> /// </summary> public RenderProfile(RenderProfile src) { #if !MACRODOC _fontName = src._fontName; _japaneseFontName = src._japaneseFontName; _fontSize = src._fontSize; _useClearType = src._useClearType; _japaneseFont = _font = null; _forecolor = src._forecolor; _bgcolor = src._bgcolor; _esColorSet = (EscapesequenceColorSet)src._esColorSet.Clone(); _bgbrush = _brush = null; _backgroundImageFileName = src._backgroundImageFileName; _imageLoadIsAttempted = false; _imageStyle = src.ImageStyle; #endif }
public void DrawText(FontHandle textFont, string text, PaintMode paintModes, bool allowAutoHinting, float size) { unsafe { int mm = matrixMode; // Get current matrix: float *m = stackalloc float[9]; vgGetMatrix(m); // Switch to glyph matrix if not already: if (mm != (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE) { vgSeti(ParamType.VG_MATRIX_MODE, (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE); vgLoadMatrix(m); } // Render text: //vgScale(size, size); // TODO: restore VG_GLYPH_ORIGIN afterwards? float *origin = stackalloc float[2]; origin[0] = 0f; origin[1] = 0f; vgSetfv(ParamType.VG_GLYPH_ORIGIN, 2, origin); //var glyphIndices = System.Text.Encoding.UTF32.GetBytes(text); DrawGlyphString(textFont, text, paintModes, false); // Restore matrix mode: if (mm != (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE) { // TODO: restore glyph matrix before switching back? vgSeti(ParamType.VG_MATRIX_MODE, mm); } // Restore old matrix: vgLoadMatrix(m); } }
/// <summary> /// This method creates a Frost cluster geometry from DirectWrite glyphs. /// </summary> /// <param name="key"> This parameter contains the cluster key information. </param> /// <param name="bidiLevel"> This parameter contains the bidi level for the cluster. </param> /// <param name="font"> This parameter references the font for the cluster. </param> /// <returns> This method returns the geometry for the cluster key. </returns> public Shape CreateGeometry(TextGeometryKey key, bool isVertical, bool isRightToLeft, FontHandle font) { Contract.Requires(font != null); FontFace face = font.ResolveFace(); _GeometryBuilder = Shape.Create(); Shape result; try { face.GetGlyphRunOutline( 1.0f, key.Indices, key.Advances, key.Offsets, isVertical, isRightToLeft, this); } finally { result = _GeometryBuilder.Build(); } return result; }
private void CreateFonts() { _font = new FontHandle(GUtil.CreateFont(_fontName, _fontSize)); FontStyle fs = _font.Font.Style; _boldfont = new FontHandle(new Font(_font.Font, fs | FontStyle.Bold)); _underlinefont = new FontHandle(new Font(_font.Font, fs | FontStyle.Underline)); _boldunderlinefont = new FontHandle(new Font(_font.Font, fs | FontStyle.Underline | FontStyle.Bold)); _japaneseFont = new FontHandle(new Font(_japaneseFontName, _fontSize)); fs = _japaneseFont.Font.Style; _japaneseBoldfont = new FontHandle(new Font(_japaneseFont.Font, fs | FontStyle.Bold)); _japaneseUnderlinefont = new FontHandle(new Font(_japaneseFont.Font, fs | FontStyle.Underline)); _japaneseBoldunderlinefont = new FontHandle(new Font(_japaneseFont.Font, fs | FontStyle.Underline | FontStyle.Bold)); _usingIdenticalFont = (_font.Font.Name == _japaneseFont.Font.Name); //通常版 Graphics g = Graphics.FromHwnd(Win32.GetDesktopWindow()); #if false SizeF charsize1 = g.MeasureString("A", _font.Font); SizeF charsize2 = g.MeasureString("AA", _font.Font); _pitch = new SizeF(charsize2.Width - charsize1.Width, charsize1.Height); _chargap = (charsize1.Width - _pitch.Width) / 2; #else IntPtr hdc = g.GetHdc(); Win32.SelectObject(hdc, _font.HFONT); Win32.SIZE charsize1, charsize2; Win32.GetTextExtentPoint32(hdc, "A", 1, out charsize1); Win32.GetTextExtentPoint32(hdc, "AAA", 3, out charsize2); _pitch = new SizeF((charsize2.width - charsize1.width) / 2, charsize1.height); _chargap = (charsize1.width - _pitch.Width) / 2; g.ReleaseHdc(hdc); #endif g.Dispose(); }
// Overriding the callback method will allow us to provide our own custom behavior protected override LResult WindowProcedure(WindowHandle window, MessageType message, WParam wParam, LParam lParam) { switch (message) { // The Paint message is sent when the Window contents need drawn. case MessageType.Paint: // Drawing is done in a Device Context by calling BeginPaint(). When the // DeviceContext is disposed it will call EndPaint(). using (DeviceContext dc = window.BeginPaint()) { Rectangle client = window.GetClientRectangle(); // The default font is really small on modern PCs, so we'll take the extra step // to select a font into our device context before drawing the text. using FontHandle font = Gdi.CreateFont( height: client.Height / 5, family: FontFamilyType.Swiss); dc.SelectObject(font); // Draw the given text in the middle of the client area of the Window. dc.DrawText( "Hello, .NET Core!", client, TextFormat.SingleLine | TextFormat.Center | TextFormat.VerticallyCenter); // Put the system font back as we're going to dispose our font dc.SelectObject(StockFont.System); } // Return 0 to indicate we've handled the message return(0); } // Let the base class handle any other messages return(base.WindowProcedure(window, message, wParam, lParam)); }
/// <summary> /// This method creates a Frost cluster geometry from DirectWrite glyphs. /// </summary> /// <param name="key"> This parameter contains the cluster key information. </param> /// <param name="bidiLevel"> This parameter contains the bidi level for the cluster. </param> /// <param name="font"> This parameter references the font for the cluster. </param> /// <returns> This method returns the geometry for the cluster key. </returns> public Geometry CreateGeometry(TextGeometryKey key, byte bidiLevel, FontHandle font) { Contract.Requires(font != null); FontFace face = font.ResolveFace(); _GeometryBuilder = Geometry.Create(); Geometry result; try { bool isRightToLeft = Convert.ToBoolean(bidiLevel & 1); face.GetGlyphRunOutline( 1.0f, key.Indices, key.Advances, key.Offsets, false, isRightToLeft, this); } finally { result = _GeometryBuilder.Build(); } return result; }
public unsafe void DrawGlyphs(FontHandle font, uint glyphCount, uint *glyphIndices, PaintMode paintModes, bool allowAutoHinting) { vgDrawGlyphs(font, glyphCount, glyphIndices, null, null, (uint)paintModes, allowAutoHinting ? 1U : 0); }
public void DrawGlyph(FontHandle font, uint glyphIndex, PaintMode paintModes, bool allowAutoHinting) { vgDrawGlyph(font, glyphIndex, (uint)paintModes, allowAutoHinting ? 1U : 0); }
public int sceFontGetCharImageRect(FontHandle FontHandle, ushort CharCode, CharRect* CharRectPointer) { throw (new NotImplementedException()); }
public void SetGlyphToPath(FontHandle font, uint glyphIndex, PathHandle path, bool isHinted, float[] origin, float[] escapement) { vgSetGlyphToPath(font, glyphIndex, path, isHinted ? 1U : 0, origin, escapement); }
public int sceFontClose(FontHandle FontHandle) { Fonts.Remove(FontHandle); return 0; }
public int sceFontGetFontInfo(FontHandle FontHandle, FontInfo* FontInfo) { FontInfo[0] = new FontInfo() { }; return 0; }
public int sceFontClose(FontHandle fontHandle) { throw(new NotImplementedException()); //return 0; }
protected override LResult WindowProcedure(WindowHandle window, MessageType message, WParam wParam, LParam lParam) { switch (message) { case MessageType.InputLanguageChange: dwCharSet = (CharacterSet)(uint)wParam; goto case MessageType.Create; case MessageType.Create: using (DeviceContext dc = window.GetDeviceContext()) { using (FontHandle font = Gdi.CreateFont(0, 0, 0, 0, FontWeight.DoNotCare, false, false, false, dwCharSet, OutputPrecision.Default, ClippingPrecision.Default, Quality.Default, FontPitch.FixedPitch, FontFamilyType.DoNotCare, null)) { dc.SelectObject(font); dc.GetTextMetrics(out TextMetrics tm); cxChar = tm.AverageCharWidth; cyChar = tm.Height; dc.SelectObject(StockFont.System); } } goto CalculateSize; case MessageType.Size: cxClient = lParam.LowWord; cyClient = lParam.HighWord; CalculateSize: // calculate window size in characters cxBuffer = Math.Max(1, cxClient / cxChar); cyBuffer = Math.Max(1, cyClient / cyChar); // allocate memory for buffer and clear it pBuffer = new char[cxBuffer, cyBuffer]; // set caret to upper left corner xCaret = 0; yCaret = 0; if (window == Windows.GetFocus()) { Windows.SetCaretPosition(new Point(xCaret * cxChar, yCaret * cyChar)); } window.Invalidate(true); return(0); case MessageType.SetFocus: // create and show the caret window.CreateCaret(default, new Size(cxChar, cyChar)); Windows.SetCaretPosition(new Point(xCaret * cxChar, yCaret * cyChar)); window.ShowCaret(); return(0); case MessageType.KillFocus: // hide and destroy the caret window.HideCaret(); Windows.DestroyCaret(); return(0); case MessageType.KeyDown: switch ((VirtualKey)wParam) { case VirtualKey.Home: xCaret = 0; break; case VirtualKey.End: xCaret = cxBuffer - 1; break; case VirtualKey.Prior: yCaret = 0; break; case VirtualKey.Next: yCaret = cyBuffer - 1; break; case VirtualKey.Left: xCaret = Math.Max(xCaret - 1, 0); break; case VirtualKey.Right: xCaret = Math.Min(xCaret + 1, cxBuffer - 1); break; case VirtualKey.Up: yCaret = Math.Max(yCaret - 1, 0); break; case VirtualKey.Down: yCaret = Math.Min(yCaret + 1, cyBuffer - 1); break; case VirtualKey.Delete: for (int x = xCaret; x < cxBuffer - 1; x++) { pBuffer[x, yCaret] = pBuffer[x + 1, yCaret]; } pBuffer[cxBuffer - 1, yCaret] = ' '; window.HideCaret(); using (DeviceContext dc = window.GetDeviceContext()) { using (FontHandle font = Gdi.CreateFont(0, 0, 0, 0, FontWeight.DoNotCare, false, false, false, dwCharSet, OutputPrecision.Default, ClippingPrecision.Default, Quality.Default, FontPitch.FixedPitch, FontFamilyType.DoNotCare, null)) { dc.SelectObject(font); unsafe { fixed(char *c = &pBuffer[xCaret, yCaret]) dc.TextOut( new Point(xCaret * cxChar, yCaret * cyChar), new ReadOnlySpan <char>(c, cxBuffer - xCaret)); } dc.SelectObject(StockFont.System); } window.ShowCaret(); } break; } Windows.SetCaretPosition(new Point(xCaret * cxChar, yCaret * cyChar)); return(0); case MessageType.Char: for (int i = 0; i < lParam.LowWord; i++) { switch ((char)wParam) { case '\b': // backspace if (xCaret > 0) { xCaret--; window.SendMessage(MessageType.KeyDown, (uint)VirtualKey.Delete, 1); } break; case '\t': // tab do { window.SendMessage(MessageType.Char, ' ', 1); } while (xCaret % 8 != 0); break; case '\n': // line feed if (++yCaret == cyBuffer) { yCaret = 0; } break; case '\r': // carriage return xCaret = 0; if (++yCaret == cyBuffer) { yCaret = 0; } break; case '\x1B': // escape for (int y = 0; y < cyBuffer; y++) { for (int x = 0; x < cxBuffer; x++) { pBuffer[x, y] = ' '; } } xCaret = 0; yCaret = 0; window.Invalidate(false); break; default: // character codes pBuffer[xCaret, yCaret] = (char)wParam; window.HideCaret(); using (DeviceContext dc = window.GetDeviceContext()) { using (FontHandle font = Gdi.CreateFont(0, 0, 0, 0, FontWeight.DoNotCare, false, false, false, dwCharSet, OutputPrecision.Default, ClippingPrecision.Default, Quality.Default, FontPitch.FixedPitch, FontFamilyType.DoNotCare, null)) { dc.SelectObject(font); unsafe { fixed(char *c = &pBuffer[xCaret, yCaret]) dc.TextOut( new Point(xCaret * cxChar, yCaret * cyChar), new ReadOnlySpan <char>(c, 1)); } dc.SelectObject(StockFont.System); } window.ShowCaret(); } if (++xCaret == cxBuffer) { xCaret = 0; if (++yCaret == cyBuffer) { yCaret = 0; } } break; } } Windows.SetCaretPosition(new Point(xCaret * cxChar, yCaret * cyChar)); return(0); case MessageType.Paint: using (DeviceContext dc = window.BeginPaint()) { using (FontHandle font = Gdi.CreateFont(0, 0, 0, 0, FontWeight.DoNotCare, false, false, false, dwCharSet, OutputPrecision.Default, ClippingPrecision.Default, Quality.Default, FontPitch.FixedPitch, FontFamilyType.DoNotCare, null)) { dc.SelectObject(font); unsafe { for (int y = 0; y < cyBuffer; y++) fixed(char *c = &pBuffer[0, y]) dc.TextOut(new Point(0, y * cyChar), new ReadOnlySpan <char>(c, cxBuffer)); } dc.SelectObject(StockFont.System); } } return(0); } return(base.WindowProcedure(window, message, wParam, lParam)); }
public int sceFontGetCharInfo(FontHandle fontHandle, uint charCode, FontCharInfo* fontCharInfo) { throw(new NotImplementedException()); }
public int sceFontGetCharInfo(FontHandle FontHandle, ushort CharCode, FontCharInfo* FontCharInfoPointer) { var Font = Fonts.Get(FontHandle); *FontCharInfoPointer = Font.GetCharInfo(CharCode); return 0; }
public int sceFontGetFontInfo(FontHandle FontHandle, FontInfo* FontInfoPointer) { var Font = Fonts.Get(FontHandle); *FontInfoPointer = Font.GetFontInfo(); return 0; }
public int sceFontGetCharInfo(FontHandle fontHandle, uint charCode, FontCharInfo *fontCharInfo) { throw(new NotImplementedException()); }
/// <summary> /// This method retrieves the geometry for a formatted cluster. /// </summary> /// <param name="clusterIndex"> This parameter indicates the formatted cluster index. </param> /// <param name="bidiLevel"> This parameter indicates the bidi level of the cluster. </param> /// <param name="font"> This parameter references the font for the cluster. </param> /// <param name="input"> This parameter references the formatted text output. </param> /// <returns> This method returns the geometry for the formatted cluster if available; otherwise, this method returns <c>null</c> . </returns> public Shape Retrieve( IndexedRange glyphRange, bool isVertical, bool isRightToLeft, FontHandle font, List<Formatting.TextShaper.Glyph> glyphs) { ResizeInternalBuffers(glyphRange.Length); int index = 0; foreach(int itemIndex in glyphRange) { _GlyphAdvances[index] = glyphs[itemIndex].Advance; _GlyphIndices[index] = glyphs[itemIndex].Index; _GlyphOffsets[index] = new GlyphOffset { AdvanceOffset = glyphs[itemIndex].Offset.Width, AscenderOffset = glyphs[itemIndex].Offset.Height }; ++index; } TextGeometryKey key; key.Advances = _GlyphAdvances; key.Indices = _GlyphIndices; key.Offsets = _GlyphOffsets; Dictionary<TextGeometryKey, Shape> cacheForFont; if(_Cache.TryGetValue(font, out cacheForFont)) { Shape result; if(cacheForFont.TryGetValue(key, out result)) { return result; } } else { cacheForFont = new Dictionary<TextGeometryKey, Shape>(); _Cache.Add(font, cacheForFont); } Shape geometry = _Sink.CreateGeometry( key, isRightToLeft, isVertical, font); TextGeometryKey newKey; newKey.Advances = (float[])key.Advances.Clone(); newKey.Indices = (short[])key.Indices.Clone(); newKey.Offsets = (GlyphOffset[])key.Offsets.Clone(); cacheForFont.Add(newKey, geometry); return geometry; }
public void DrawString(float x, float y, String s) { FontHandle fhandle = (FontHandle)currentFont; _graphics.DrawString(s, fhandle.Handle, currentBrush, x, (y - fhandle.Baseline), _stringFormat); }
public void Dispose() { vg.DestroyFont(this.fontHandle); this.fontHandle = FontHandle.Invalid; this.escapements = null; }
public void DestroyFont(FontHandle font) { vgDestroyFont(font); }
public int sceFontFlush(FontHandle FontHandle) { return 0; }