+ All Categories
Home > Documents > Windows Programming Text and Fonts This presentation will probably involve audience discussion,...

Windows Programming Text and Fonts This presentation will probably involve audience discussion,...

Date post: 01-Jan-2016
Category:
Upload: kristina-mills
View: 219 times
Download: 1 times
Share this document with a friend
Popular Tags:
31
Windows Programming Text and Fonts Presented By:- Anchal Sharma
Transcript
Page 1: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

Windows Programming

Text and Fonts

Presented By:-Anchal Sharma

Page 2: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

2

Introduction

Text FontsGDI (Graphics Device Interface)Drawing and FillingWindows APIs

Page 3: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

3

Text Basics (Requirements)

Text Tradition Art Technology

Soft proofing

Page 4: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

4

Fonts Basics

Family (Roman)Style (Italicize condense etc.)Size (Point 1/72“)

Page 5: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

5

Font Families

A font family is a set of fonts having common stroke width and serif characteristics. There are five font families. A sixth family allows an application to use the default font.

Page 6: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

6

Font family Description

Decorative Specifies a novelty font. An example is Old English.

Dontcare Specifies a generic family name. This name is used when information about a font does not exist or does not matter. The default font is used.

Modern Specifies a monospace font with or without serifs. Monospace fonts are usually modern; examples include Pica, Elite, and Courier New.

Roman Specifies a proportional font with serifs. An example is Times New Roman.

Script Specifies a font that is designed to look like handwriting; examples include Script and Cursive.

Swiss Specifies a proportional font without serifs. An example is Arial.

Page 7: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

7

Font Size

Page 8: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

8

GDI

Abstraction Device Independence Responsibility of the programmer

Parts Text Filled Areas Lines and curves Bitmaps

Page 9: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

9

GDI Objects

Class Windows handle type

CPen HPEN

CBrush HBRUSH

CFont HFONT

CBitmap HBITMAP

CPalette HPALETTE

CRgn HRGN

Page 10: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

10

Device Context

BeginPaintGetDC / ReleaseDC NULL param gives screen Hwnd param gives client

CreateDC(“DISPLAY”,…);GetWindowDC

Page 11: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

11

Fonts (Windows)

GDI Fonts / Device Fonts Raster(nonscaleable) : SYSTEM_FONT,

SYSTEM_FIXED_FONT, OEM_FIXED_FONT, Courier, Ms Serif, MS Sans Serif, Small Fonts

stroke : Connect the dots (Modern Roman Script) Plotter fonts

True Type / OpenType

GetStockObject Cannot be specific about selection DEFAULT_GUI_FONT: MS Sans Serif

Page 12: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

12

Font Consistency

Embedding: GetOutlineTextMetrics() otmfsType=1

OUTLINETEXTMETRIC structure

System FontsUsing of Fonts Enumeration User Choice Fixed type (sys fonts)

Page 13: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

13

Font Storages (Windows)

Historically, font sizes were large to fit standard disks.Just like .dllRaster/Vector: .fon file contains dataOpenType/TrueType: .fon file is header and .ttf file contains the data

Page 14: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

14

Character Set

Encoding scheme Unicode (multi-byte codes) OEM Windows Vendor (external like EBCDIC)

Page 15: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

15

GDI (Co-ordinates/Mapping)

Mapping mode does not change messagesScreen Coordinates/Client CordinatesSetViewPortOrgEx: DeviceSetWindowOrgEx: Logical

Page 16: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

16

Mapping Mode Logical Unit x-axis y-axis

MM_TEXT Pixel Right Down

MM_LOMETRIC 0.1 mm Right Up

MM_HIMETRIC 0.01 mm Right Up

MM_LOENGLISH 0.01 in. Right Up

MM_HIENGLISH 0.001 in. Right Up

MM_TWIPS 1/1440 in. Right Up

MM_ISOTROPIC Arbitrary (x = y) Selectable Selectable

MM_ANISOTROPIC Arbitrary (x !=y) Selectable Selectable

Mapping Modes

Page 17: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

17

Logical Inches

Size of inch is larger on displaySize of inch is same on printer

Page 18: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

18

Drawing

Lines MoveTo LineTo

Bezier PolyBezier PolyBezierTo

Arcs AngleArc Arc, ArcTo

Page 19: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

19

Creating Paths / Regions

ClippingFillingDrawingFunctions BeginPath(hdc) draw lines etc.

connected and then EndPath(hdc) CreateRectRgn, CreateRoundRectRgn

Page 20: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

20

Shapes

Ellipse Pie Rectangle

ChordPolygon

Shapes

Page 21: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

21

Styling the Shapes

Fill BrushSetROP2 : Raster OperationsSetFillPoly Winding Alternate

FillRect, FillRoundRect

Page 22: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

22

Text APIs

TextOut(hdc,ystart,pString,iCount) Does not recognize null character

strings GDI function

TabbedTextOut(hdc,xStart,yStart,pString, iCount, iNumTabs, piTabStops, xTabOrigin); iNumTabs=NULL (def 8) iNumTabs=1 (piTabStops repeated arg.)

Page 23: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

23

Text API s Cont…

ExtTextOut(hdc,xSt,ySt,iOpt, &rect,pString, iCount, pxDistance); ETO_CLIPPED , ETO_OPAQUE, pxDistance=spacings,

null for def.

DrawText(hdc,pString,iCount, &rect,iFormat); Recognize null terminated Strings. Also \n \r \t For \t use DT_EXPANDTABS If TA_CENTER then ½ text DT_TABSTOP

DrawTextEx(hdc,pString,iCount,&rect, iFormat,&drawtextparams); Works on avg character increments

Page 24: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

24

Text API’s Cont…

SetTextCharacterExtra(hdc, iExtra); iExtra cannot be –ve (absolute value

taken)

TEXTMETRICS tm.Hieght is not font size it includes

internal leading.

Page 25: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

25

tagTEXTMETRIC Structure

TEXTMETRIC tmHeight tmAscent tmDescent tmInternalLeading tmExternalLeading tmAveCharWidth tmMaxCharWidth tmOverhang tmDigitizedAspectX tmDigitizedAspectY

tmFirstChartmLastChartmDefaultChar tmBreakChar tmItalic tmUnderlined tmStruckOut tmPitchAndFamily tmCharSet

Page 26: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

26

Pitch & Family

TMPF_FIXED_PITCH

TMPF_VECTOR

TMPF_TRUETYPE

TMPF_DEVICE

0X01

0X02

0X03

0X04

Page 27: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

27

Font API’s

CreateFont, CreateFontIndirect, GetTextFace, GetTextMetrics.lfCharSet : only value with default 1Struct: LOGFONT,CHOOSEFONT,PANOSEGetOutlineTextMetrics: PANOSE

Page 28: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

28

WinNT/Win98

SetGraphicsMode(GM_ADVANCED) WinNt: escapement, orientations.

SetWorldTransform Mode should be advanced

Page 29: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

29

Kerning/Antialiasing

DWORD GetKerningPairs( HDC hdc, DWORD nNumPairs, LPKERNINGPAIR lpkrnpair);Anti – aliasing: GetDeviceCaps

Page 30: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

30

References

Charles Petzold, Programming Windows, 5th EditionText and Fonts, Msdn LibraryLines and Curves, Msdn LibraryK.P. Rao, Printing classes

Page 31: Windows Programming Text and Fonts This presentation will probably involve audience discussion, which will create action items. Use PowerPoint to keep.

31

Thank You

Questions?


Recommended