SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
Bonding with Pango

     Travis Griggs
     GUI/Tools Lead
    15 September 2010
Who Am I?

• Not yet 40
• Cincom GUI/Tools Team Lead
• Since ObjectWorks 4.0 (HPUX Beta)
What’s This About?

• Not a Tutorial
• Experience Report
• I’m no expert, I just know more than I used to
What’s Pango?

• Παν
• “Pango is a library for laying out and rendering of text,
 with an emphasis on internationalization. Pango can be
 used anywhere that text layout is needed... ...The
 integration of Pango with Cairo provides a complete
 solution with high quality text handling and graphics
 rendering.”
• Owen Taylor
• Behdad Esfahbod
Our Baseline

• Classic Roman Text Rendering
  1:1 code point to grapheme mapping
  Left to Right

• ComposedText (Paragraph)
    indenting & tabs (left)
    word wrapping
    alignment
    justification
    font resolution (underline, bold, italic, color, couple others)
Challenge 1: Glyph Resolution

• Want to show strings of mixed charsets (despite any
 base font)
• Will it show everything? Yes... if you have enough fonts
• First rite of passage: “The Character Map Viewer”
Challenge 2: Right to Left Rendering

•           wef a eman to ,werbeH ,naisreP ,cibarA
•             ...sdrow dnasuoht a htrow s’erutcip A
Challenge 3: BIDI

• Bi-Directional text support
• If we mix texts of different directions, we’d like that to
 look right too
• Yeesh. Yet another “Hello World” example...
• Followed by a more “timely” example...
Challenge 4: Shaping

• The story of Å and Å, the Diacritical Twins
• Back to our sandbox to play some more...
Challenge 5: Vertical Text

• Some writing systems still go right to left in vertical
 columns (e.g. Asian Print)
• Another example...
Challenge 6: Text Transformation

• In addition to drawing, Pango can emit vector
 information for the outlines of the glyphs it would draw
• Once we have the vectors, we can manipulate it
 however we want
• More Demos (2 of ‘em)...
Challenge 7: Interacting with Layouts

• For many, just rendering is enough
• If your user will “interact” with these layouts though, you
 need to be able to translate to/from the input devices the
 user uses
• Final “Rite of Passage”, building a real editor...
Binding Overview
• Similiar to CairoGraphics binding
• As Faithful as Possible to Pango API names
• Pango coordinates always in scaled integers (x1024),
 always converted via toPangoScale/fromPangoScale
• Only the “basic” APIs, no need to engage the low level
 rendering pipeline APIs (yet)
• Only mapped for the Cairo backend
Binding Overview: Layout
• Primary Object; everything ComposedText does plus:
    Variable line height
    Forced single line mode
    Direction control (explicit or automatic)
    Ellipsification
    Simple API for setting font/size
    Spacing
    3 kinds of word wrap
    Various measuring APIs
     •   ink and logical extents
     •   cursor locating
     •   points to positions
     •   positions to points
Binding Overview: FontDescription

• Describes a font request, either in full, or partial
• Simple fromString: creator (e.g. ‘Arial, 24’ ‘Mincho, 13px’)
• Can set/get:
     family
     gravity
     pixel size
     point size
     stretch (condensed, expanded, etc)
     style (oblique, normal, italic)
     variant (normal, smallCaps)
     weight (boldness)
Binding Overview: LayoutLine

• Additional querying/measurements
• Can be rendered/pathed individually
Binding Overview: Iterator

• Enumerates Layouts
     by line...
     or by character...
     or by cluster...
     or by run...

• Accesses the current one of any of those
• Other measuring/querying information
   extents
   current y values and baseline
Binding Overview: PangoContext

• Usually “just taken care of”
• Can be used to access/set:
     resolution (ppi)
     gravity
     direction
     default FontDescription

• Query available font families
• Query font metrics
Binding Overview: TabArray

• Manages tab information for a Layout
• Similiar to an Array interface
• APIs for setting left, right, center, and numeric tabs, but
 currently only actually does left
Binding Overview: Various Constants

• Each Pango ENUM type is turned into a subclass of
 CairoGraphics.Constant
• ENUM members are expressed as class side methods
• Example:
     aLayout ellipsization: EllipsizeMode right
Binding Overview: AttributeList

• One per Layout
• Analogous to RunArray
• Array like API
• contains Attributes
Binding Overview: Attribute
• Models a Range (or if no start/stop given, does all)
• Analogous to Text emphases
     backgroundColor             rise
     family                      scale
     fontDescription             stretch
     foregroundColor             strikethrough
     gravity                     strikethroughColor
     gravityHint                 style (oblique as well as italic)
     language                    underline (but 5 different kinds)
     letterSpacing               underlineColor
     pixelSize                   variant
     pointSize                   weight
• Interned in Pango library, so not extensible
Binding Overview: ShapeAttribute
• Takes a “data” pointer and extents (ink and logical)
• Context’s shape render callback processes them
• block: [:cr :attribute :doPath | ]
 ink: aRectangle
 logical: bRectangle
• Blocks registered in a Smalltalk registry and associated
  with the data value of the attribute, single universal
  callback finds block associated with ShapeAttribute
  instance and dispatches it
• Only does text replacement (for now)
• Pictures again?
Binding Overview: Markup
• Attributes can be computed from markup
• Example:
   ‘<b>Hello</b> <i>ESUG</i>’
   ‘Travis is <span size=”x-large”>feeling</span> <span
 color=”blue”>blue</span>’
Issues: Memory Management

• Borrows same mechanism used by Cairo binding
• Not as consistent
   some Pango structures are ref counted (like Cairo)
   some are not refcounted, but still need to be freed if we created
    them
   others are just interfaces and need no memory management

• No fun to figure out when it goes wrong
Issues: UTF8

• Can’t Random Access
• Size has to be computed
• Not as difficult tho, when you work in pointers
• Many Pango APIs are done in 0 based byte offsets,
 which may jump
• No Endianness Issue
• Compact
Issues: Different Platforms

• Pango installed on any current Linux up-to-date distro
• Seems to work well on Windows, a real pain to build
 there though
• Not good for “non-ascii” on OSX yet (needs CoreText),
 not so bad to build
• Older Unix/X11 installs... mostly unknown
Cincom’s Plans

• None of what you’ve seen today is “committed” product
  direction
• Recognition is the first step - Modern International Text
  Layout is quite involved
• Some Observations:
     Pango is the “native solution” for Linux world
     Uniscribe is the “native solution” for Windows world
     CoreText is the “native solution” for OSX world (>= 10.5)
     GTK builds and uses Pango on Windows and OSX
• All in Smalltalk instead?
• Pros and Cons with using 3rd Party Libraries
Converting VisualWorks

• Could we just replace VW text rendering primitives with
 Pango calls?
• Let me show you...
?

Contenu connexe

Similaire à Bonding with Pango

Hunting for anglerfish in datalakes
Hunting for anglerfish in datalakesHunting for anglerfish in datalakes
Hunting for anglerfish in datalakesDominic Egger
 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlpankit_ppt
 
introtonlp-190218095523 (1).pdf
introtonlp-190218095523 (1).pdfintrotonlp-190218095523 (1).pdf
introtonlp-190218095523 (1).pdfAdityaMishra178868
 
Programming Languages #devcon2013
Programming Languages #devcon2013Programming Languages #devcon2013
Programming Languages #devcon2013Iván Montes
 
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)daylerees
 
Understanding Character Encodings
Understanding Character EncodingsUnderstanding Character Encodings
Understanding Character EncodingsMobisoft Infotech
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPAGil Fink
 
Open Standards in the Walled Garden
Open Standards in the Walled GardenOpen Standards in the Walled Garden
Open Standards in the Walled Gardendigitalbindery
 
I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?sbjug
 
High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014Derek Collison
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP PerspectiveBarry Jones
 
Infinum Android Talks #03 - Android Design Best Practices - for Designers and...
Infinum Android Talks #03 - Android Design Best Practices - for Designers and...Infinum Android Talks #03 - Android Design Best Practices - for Designers and...
Infinum Android Talks #03 - Android Design Best Practices - for Designers and...Infinum
 
Metaprogramming Go
Metaprogramming GoMetaprogramming Go
Metaprogramming GoWeng Wei
 
IntroPython-Week02-StringsIteration.pptx
IntroPython-Week02-StringsIteration.pptxIntroPython-Week02-StringsIteration.pptx
IntroPython-Week02-StringsIteration.pptxchrisdy932
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type scriptGil Fink
 
Android Talks #3 Android Design Best Practices - for Designers and Developers
Android Talks #3 Android Design Best Practices - for Designers and DevelopersAndroid Talks #3 Android Design Best Practices - for Designers and Developers
Android Talks #3 Android Design Best Practices - for Designers and DevelopersDenis_infinum
 

Similaire à Bonding with Pango (20)

Hunting for anglerfish in datalakes
Hunting for anglerfish in datalakesHunting for anglerfish in datalakes
Hunting for anglerfish in datalakes
 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlp
 
introtonlp-190218095523 (1).pdf
introtonlp-190218095523 (1).pdfintrotonlp-190218095523 (1).pdf
introtonlp-190218095523 (1).pdf
 
Groovy Programming Language
Groovy Programming LanguageGroovy Programming Language
Groovy Programming Language
 
Programming Languages #devcon2013
Programming Languages #devcon2013Programming Languages #devcon2013
Programming Languages #devcon2013
 
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
 
Understanding Character Encodings
Understanding Character EncodingsUnderstanding Character Encodings
Understanding Character Encodings
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
 
Open Standards in the Walled Garden
Open Standards in the Walled GardenOpen Standards in the Walled Garden
Open Standards in the Walled Garden
 
I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?I know Java, why should I consider Clojure?
I know Java, why should I consider Clojure?
 
High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014High Performance Systems in Go - GopherCon 2014
High Performance Systems in Go - GopherCon 2014
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP Perspective
 
Core text
Core textCore text
Core text
 
Infinum Android Talks #03 - Android Design Best Practices - for Designers and...
Infinum Android Talks #03 - Android Design Best Practices - for Designers and...Infinum Android Talks #03 - Android Design Best Practices - for Designers and...
Infinum Android Talks #03 - Android Design Best Practices - for Designers and...
 
Metaprogramming Go
Metaprogramming GoMetaprogramming Go
Metaprogramming Go
 
IntroPython-Week02-StringsIteration.pptx
IntroPython-Week02-StringsIteration.pptxIntroPython-Week02-StringsIteration.pptx
IntroPython-Week02-StringsIteration.pptx
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type script
 
Introduction to MapBasic
Introduction to MapBasicIntroduction to MapBasic
Introduction to MapBasic
 
Should i Go there
Should i Go thereShould i Go there
Should i Go there
 
Android Talks #3 Android Design Best Practices - for Designers and Developers
Android Talks #3 Android Design Best Practices - for Designers and DevelopersAndroid Talks #3 Android Design Best Practices - for Designers and Developers
Android Talks #3 Android Design Best Practices - for Designers and Developers
 

Plus de ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

Plus de ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Dernier

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Dernier (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Bonding with Pango

  • 1. Bonding with Pango Travis Griggs GUI/Tools Lead 15 September 2010
  • 2. Who Am I? • Not yet 40 • Cincom GUI/Tools Team Lead • Since ObjectWorks 4.0 (HPUX Beta)
  • 3. What’s This About? • Not a Tutorial • Experience Report • I’m no expert, I just know more than I used to
  • 4. What’s Pango? • Παν • “Pango is a library for laying out and rendering of text, with an emphasis on internationalization. Pango can be used anywhere that text layout is needed... ...The integration of Pango with Cairo provides a complete solution with high quality text handling and graphics rendering.” • Owen Taylor • Behdad Esfahbod
  • 5. Our Baseline • Classic Roman Text Rendering  1:1 code point to grapheme mapping  Left to Right • ComposedText (Paragraph)  indenting & tabs (left)  word wrapping  alignment  justification  font resolution (underline, bold, italic, color, couple others)
  • 6. Challenge 1: Glyph Resolution • Want to show strings of mixed charsets (despite any base font) • Will it show everything? Yes... if you have enough fonts • First rite of passage: “The Character Map Viewer”
  • 7. Challenge 2: Right to Left Rendering • wef a eman to ,werbeH ,naisreP ,cibarA • ...sdrow dnasuoht a htrow s’erutcip A
  • 8. Challenge 3: BIDI • Bi-Directional text support • If we mix texts of different directions, we’d like that to look right too • Yeesh. Yet another “Hello World” example... • Followed by a more “timely” example...
  • 9. Challenge 4: Shaping • The story of Å and Å, the Diacritical Twins • Back to our sandbox to play some more...
  • 10. Challenge 5: Vertical Text • Some writing systems still go right to left in vertical columns (e.g. Asian Print) • Another example...
  • 11. Challenge 6: Text Transformation • In addition to drawing, Pango can emit vector information for the outlines of the glyphs it would draw • Once we have the vectors, we can manipulate it however we want • More Demos (2 of ‘em)...
  • 12. Challenge 7: Interacting with Layouts • For many, just rendering is enough • If your user will “interact” with these layouts though, you need to be able to translate to/from the input devices the user uses • Final “Rite of Passage”, building a real editor...
  • 13. Binding Overview • Similiar to CairoGraphics binding • As Faithful as Possible to Pango API names • Pango coordinates always in scaled integers (x1024), always converted via toPangoScale/fromPangoScale • Only the “basic” APIs, no need to engage the low level rendering pipeline APIs (yet) • Only mapped for the Cairo backend
  • 14. Binding Overview: Layout • Primary Object; everything ComposedText does plus:  Variable line height  Forced single line mode  Direction control (explicit or automatic)  Ellipsification  Simple API for setting font/size  Spacing  3 kinds of word wrap  Various measuring APIs • ink and logical extents • cursor locating • points to positions • positions to points
  • 15. Binding Overview: FontDescription • Describes a font request, either in full, or partial • Simple fromString: creator (e.g. ‘Arial, 24’ ‘Mincho, 13px’) • Can set/get:  family  gravity  pixel size  point size  stretch (condensed, expanded, etc)  style (oblique, normal, italic)  variant (normal, smallCaps)  weight (boldness)
  • 16. Binding Overview: LayoutLine • Additional querying/measurements • Can be rendered/pathed individually
  • 17. Binding Overview: Iterator • Enumerates Layouts  by line...  or by character...  or by cluster...  or by run... • Accesses the current one of any of those • Other measuring/querying information  extents  current y values and baseline
  • 18. Binding Overview: PangoContext • Usually “just taken care of” • Can be used to access/set:  resolution (ppi)  gravity  direction  default FontDescription • Query available font families • Query font metrics
  • 19. Binding Overview: TabArray • Manages tab information for a Layout • Similiar to an Array interface • APIs for setting left, right, center, and numeric tabs, but currently only actually does left
  • 20. Binding Overview: Various Constants • Each Pango ENUM type is turned into a subclass of CairoGraphics.Constant • ENUM members are expressed as class side methods • Example: aLayout ellipsization: EllipsizeMode right
  • 21. Binding Overview: AttributeList • One per Layout • Analogous to RunArray • Array like API • contains Attributes
  • 22. Binding Overview: Attribute • Models a Range (or if no start/stop given, does all) • Analogous to Text emphases  backgroundColor  rise  family  scale  fontDescription  stretch  foregroundColor  strikethrough  gravity  strikethroughColor  gravityHint  style (oblique as well as italic)  language  underline (but 5 different kinds)  letterSpacing  underlineColor  pixelSize  variant  pointSize  weight • Interned in Pango library, so not extensible
  • 23. Binding Overview: ShapeAttribute • Takes a “data” pointer and extents (ink and logical) • Context’s shape render callback processes them • block: [:cr :attribute :doPath | ] ink: aRectangle logical: bRectangle • Blocks registered in a Smalltalk registry and associated with the data value of the attribute, single universal callback finds block associated with ShapeAttribute instance and dispatches it • Only does text replacement (for now) • Pictures again?
  • 24. Binding Overview: Markup • Attributes can be computed from markup • Example: ‘<b>Hello</b> <i>ESUG</i>’ ‘Travis is <span size=”x-large”>feeling</span> <span color=”blue”>blue</span>’
  • 25. Issues: Memory Management • Borrows same mechanism used by Cairo binding • Not as consistent  some Pango structures are ref counted (like Cairo)  some are not refcounted, but still need to be freed if we created them  others are just interfaces and need no memory management • No fun to figure out when it goes wrong
  • 26. Issues: UTF8 • Can’t Random Access • Size has to be computed • Not as difficult tho, when you work in pointers • Many Pango APIs are done in 0 based byte offsets, which may jump • No Endianness Issue • Compact
  • 27. Issues: Different Platforms • Pango installed on any current Linux up-to-date distro • Seems to work well on Windows, a real pain to build there though • Not good for “non-ascii” on OSX yet (needs CoreText), not so bad to build • Older Unix/X11 installs... mostly unknown
  • 28. Cincom’s Plans • None of what you’ve seen today is “committed” product direction • Recognition is the first step - Modern International Text Layout is quite involved • Some Observations:  Pango is the “native solution” for Linux world  Uniscribe is the “native solution” for Windows world  CoreText is the “native solution” for OSX world (>= 10.5)  GTK builds and uses Pango on Windows and OSX • All in Smalltalk instead? • Pros and Cons with using 3rd Party Libraries
  • 29. Converting VisualWorks • Could we just replace VW text rendering primitives with Pango calls? • Let me show you...
  • 30. ?