i have a textbox in which i write in bangla(Bengali). but when i try to convert the bangla text into a GIF file the image shows ????? or something like a box. By the way i used AVRO Bangla typing software. - using System;
-
using System.Data;
-
using System.Configuration;
-
using System.Web;
-
using System.Web.Security;
-
using System.Web.UI;
-
using System.Web.UI.WebControls;
-
using System.Web.UI.WebControls.WebParts;
-
using System.Web.UI.HtmlControls;
-
using System.Text;
-
using System.Drawing;
-
using System.Drawing.Imaging;
-
using System.Drawing.Text;
-
using System.Drawing.Drawing2D;
-
-
-
-
public partial class _Default : System.Web.UI.Page
-
{
-
protected void Page_Load(object sender, EventArgs e)
-
{
-
-
}
-
-
-
protected void TextBox4_TextChanged1(object sender, EventArgs e)
-
{
-
string s = TextBox4.Text;
-
System.Console.WriteLine(s);
-
-
}
-
protected void Button4_Click(object sender, EventArgs e)
-
{
-
string infotext = null;
-
string text = TextBox4.Text;//Request.Form.Get("text");
-
int textLength = text.Length;
-
int fontSize = 14;
-
int orientation = 1;
-
int antialias = 1;
-
int width;
-
int height;
-
-
-
width = (fontSize * textLength) - ((textLength * fontSize) / 3);
-
height = fontSize + 20;
-
-
infotext=text;
-
-
//Byte[] sourceBytes = Encoding.GetEncoding("utf-8").GetBytes(infotext);
-
//Byte[] strbytes = Encoding.Convert(Encoding.GetEncoding(57003),Encoding.Unicode, sourceBytes);
-
//infotext = Encoding.Unicode.GetString(strbytes);
-
//text = infotext;
-
-
-
-
// Initialize graphics
-
RectangleF rectF = new RectangleF(0, 0, width, height);
-
Bitmap pic = new Bitmap(width, height, PixelFormat.Format24bppRgb);
-
Graphics g = Graphics.FromImage(pic);
-
g.SmoothingMode = SmoothingMode.AntiAlias;
-
-
g.TextRenderingHint = TextRenderingHint.AntiAlias;
-
-
-
// Set colors
-
string fgColor = "Black";
-
string bgColor = "White";
-
Color fontColor = Color.FromName(fgColor);
-
Color rectColor = Color.FromName(bgColor);
-
SolidBrush fgBrush = new SolidBrush(fontColor);
-
SolidBrush bgBrush = new SolidBrush(rectColor);
-
-
// Rectangle
-
int bound = 1;
-
g.FillRectangle(bgBrush, rectF);
-
-
// Load font
-
-
string fontName = "SUTOE___" + ".ttf";// this is bangla font file
-
PrivateFontCollection privateFontCollection = new PrivateFontCollection();
-
privateFontCollection.AddFontFile(Server.MapPath("./") + fontName);
-
-
FontFamily fontFamily = privateFontCollection.Families[0];
-
-
// Set font style
-
FontStyle style = FontStyle.Regular;
-
Font font = new Font(fontFamily, fontSize, style, GraphicsUnit.Pixel);
-
-
-
// Set font direction & alignment
-
StringFormat format = new StringFormat();
-
-
-
int alignment = 1;
-
if (alignment == 1)
-
{
-
format.Alignment = StringAlignment.Near;
-
}
-
format.LineAlignment = StringAlignment.Center;
-
-
-
-
-
// Finally, draw the font
-
g.DrawString(text, font, fgBrush, rectF, format);
-
-
-
pic.Save(Server.MapPath("~/generated_image.gif"),ImageFormat.Gif);
-
-
-
-
-
}
-
protected void Button1_Click(object sender, EventArgs e)
-
{
-
string s = TextBox4.Text;
-
System.Console.WriteLine(s);
-
}
-
}
2 1221
i have a textbox in which i write in bangla(Bengali). but when i try to convert the bangla text into a GIF file the image shows ????? or something like a box. By the way i used AVRO Bangla typing software.
Code:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.Drawing.Drawing2D;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TextBox4_TextChanged1(object sender, EventArgs e)
{
string s = TextBox4.Text;
System.Console.WriteLine(s);
}
protected void Button4_Click(object sender, EventArgs e)
{
string infotext = null;
string text = TextBox4.Text;//Request.Form.Get("text");
int textLength = text.Length;
int fontSize = 14;
int orientation = 1;
int antialias = 1;
int width;
int height;
width = (fontSize * textLength) - ((textLength * fontSize) / 3);
height = fontSize + 20;
infotext=text;
//Byte[] sourceBytes = Encoding.GetEncoding("utf-8").GetBytes(infotext);
//Byte[] strbytes = Encoding.Convert(Encoding.GetEncoding(57003),Encod ing.Unicode, sourceBytes);
//infotext = Encoding.Unicode.GetString(strbytes);
//text = infotext;
// Initialize graphics
RectangleF rectF = new RectangleF(0, 0, width, height);
Bitmap pic = new Bitmap(width, height, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(pic);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = TextRenderingHint.AntiAlias;
// Set colors
string fgColor = "Black";
string bgColor = "White";
Color fontColor = Color.FromName(fgColor);
Color rectColor = Color.FromName(bgColor);
SolidBrush fgBrush = new SolidBrush(fontColor);
SolidBrush bgBrush = new SolidBrush(rectColor);
// Rectangle
int bound = 1;
g.FillRectangle(bgBrush, rectF);
// Load font
string fontName = "SUTOE___" + ".ttf";// this is bangla font file
PrivateFontCollection privateFontCollection = new PrivateFontCollection();
privateFontCollection.AddFontFile(Server.MapPath(" ./") + fontName);
FontFamily fontFamily = privateFontCollection.Families[0];
// Set font style
FontStyle style = FontStyle.Regular;
Font font = new Font(fontFamily, fontSize, style, GraphicsUnit.Pixel);
// Set font direction & alignment
StringFormat format = new StringFormat();
int alignment = 1;
if (alignment == 1)
{
format.Alignment = StringAlignment.Near;
}
format.LineAlignment = StringAlignment.Center;
// Finally, draw the font
g.DrawString(text, font, fgBrush, rectF, format);
pic.Save(Server.MapPath("~/generated_image.gif"),ImageFormat.Gif);
}
protected void Button1_Click(object sender, EventArgs e)
{
string s = TextBox4.Text;
System.Console.WriteLine(s);
}
}
Sign in to post your reply or Sign up for a free account.
Similar topics
by: asdf sdf |
last post by:
i have an install issue with moinmoin on win2k. i've tried the mailing
list, but it appears to be a very low traffic, low subscriber list.
can i get a reality check? is anyone using moinmoin in...
|
by: Simon Harvey |
last post by:
Hi chaps,
Does anyone know if the beast is going to release Visual Tools for office to
work with Visual Studio 2002 and not just 2003, or are they quite happy to
shaft those that supported them...
|
by: Greg Steele |
last post by:
Does anyone have a copy or know where I can get an
installation executable for chiliReports 2.0 from chili!
soft? The company I'm working for bought a copy several
years ago, then moved their...
|
by: Ken Shaw |
last post by:
G'day,
I'm trying to tack down any delta compression library that I could licence
for use in a project.
Does anyone know of a decent binary delta compression library?
cheers,
Ken Shaw
|
by: james |
last post by:
Hi guys!
I´ve got a centerd table on my site with a black 1 pixel border.
What i would like to do is to add a drop shadow to the table.
Anyone know if it's possible to create a drop shadow for a...
|
by: Isaac Grover |
last post by:
Hi everyone,
Just out of curiosity I recently pointed one of my hand-typed pages at the W3
Validator, and my hand-typed code was just ripped to shreds. Then I pointed
some major sites...
|
by: Jay1969 |
last post by:
Hey all,
I heard there was a new service offered to Microsoft partners called
ISV Advisory Services (see link) where MS is giving free dev consulting
to their Partners.
...
|
by: penguin732901 |
last post by:
Checking back for discussions, there was a lot of talk about 2000 being
slower than 97, but not so much lately. What is the latest opinion?
Anyone care to set up a poll for how many NG members...
|
by: Brent Taylor via AccessMonster.com |
last post by:
HELP----DOES ANYONE HAVE A SIMPLE .mdb for MLM structure?
Does anyone have an example database for multi-level marketing for a 3 Tier
setup?
Thank you,
brenttaylor@actionimports.net
|
by: Bruno Alexandre |
last post by:
Hi guys,
does anyone know where is the Website used in the MSDN "Lear ASP.NET 2.0
with Jeff Prosise"
(http://msdn.microsoft.com/asp.net/beta2/multimedia/default.aspx) events?
The website used...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |