Title: Update PFont.java by dhowe · Pull Request #6132 · processing/processing · GitHub
Open Graph Title: Update PFont.java by dhowe · Pull Request #6132 · processing/processing
X Title: Update PFont.java by dhowe · Pull Request #6132 · processing/processing
Description: This PR adds PFont.textBounds, PFont.textToPoints from p5.js, and PFont.glyphBounds, as shown in the sketch below (there may be more efficient ways to do these). Also, I attempted to use the suggested formatter in Eclipse, but not sure the output is totally correct -- happy to get feedback/improvements... // DEMO SKETCH import java.awt.geom.*; String str = "Lorem ipsum."; float x = 20, y = 250, fsize = 150; PFont pf; void setup() { size(1000, 400); background(240); pf = createFont("Georgia", 300); fill(0); textFont(pf); textSize(fsize); text(str, x, y); noFill(); Rectangle2D.Float[] r = pf.glyphBounds(str, x, y, fsize); for (int i = 0; i < str.length(); i++) { rect(r[i].x, r[i].y, r[i].width, r[i].height); } Rectangle2D.Float rb = pf.textBounds(str, x, y, fsize); rect(rb.x, rb.y, rb.width, rb.height); stroke(200,0,0); strokeWeight(3); PVector[] pts = pf.textToPoints(str, x, y, fsize, 0.5); for (int i = 0; i < pts.length; i++) { point(pts[i].x, pts[i].y); } }
Open Graph Description: This PR adds PFont.textBounds, PFont.textToPoints from p5.js, and PFont.glyphBounds, as shown in the sketch below (there may be more efficient ways to do these). Also, I attempted to use the sugges...
X Description: This PR adds PFont.textBounds, PFont.textToPoints from p5.js, and PFont.glyphBounds, as shown in the sketch below (there may be more efficient ways to do these). Also, I attempted to use the sugges...
Opengraph URL: https://github.com/processing/processing/pull/6132
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:96ad9e09-cf6b-79ba-6e9a-49353ea645af |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 95E2:348256:EE2EE4:14F26B5:696F715A |
| html-safe-nonce | ea2299a9348b3cfe0c6f36997c9ad22ee6315120878b9d7a2ed66f791c9bcee2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUUyOjM0ODI1NjpFRTJFRTQ6MTRGMjZCNTo2OTZGNzE1QSIsInZpc2l0b3JfaWQiOiI4NDU4NjAxNjM2Mzg3ODQ0NDQyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f0731abb5b576bbaf069f926e494a16b2cfe6931e599ee51c562ed69bc67e914 |
| hovercard-subject-tag | pull_request:533020786 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/processing/processing/pull/6132/files |
| twitter:image | https://avatars.githubusercontent.com/u/737638?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/737638?s=400&v=4 |
| og:image:alt | This PR adds PFont.textBounds, PFont.textToPoints from p5.js, and PFont.glyphBounds, as shown in the sketch below (there may be more efficient ways to do these). Also, I attempted to use the sugges... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | acc7f8c2e144976eeb6e7a73826049dd183bc572ccf5eaa9afb8265c617a97ab |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/processing/processing git https://github.com/processing/processing.git |
| octolytics-dimension-user_id | 1617169 |
| octolytics-dimension-user_login | processing |
| octolytics-dimension-repository_id | 7807399 |
| octolytics-dimension-repository_nwo | processing/processing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7807399 |
| octolytics-dimension-repository_network_root_nwo | processing/processing |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cc546a224d6d4726a8d7c3a0dfe0cf65dbf9b7bd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width