What's the font family of the page title on MobileSafari? - iphone

The webpage title on MobileSafari looks carven,host to make this effect?And what's the font family and font size of the title?
Thank you very much!

Open any iOS project in Xcode.
Launch MobileSafari in the simulator and visit google.
In Xcode, choose Product > Attach to Process > MobileSafari.
Choose Product > Debug > Pause.
In the debug console, type po [[UIApp keyWindow] recursiveDescription].
Note that this only works on the simulator. On the device, you can only attach to apps that you have installed using Xcode.
Doing all that gives you a printout of Mobile Safari's view hierarchy. Searching through it, I find this UILabel:
| | | | | <UILabel: 0x1096e800; frame = (0 0; 308 16); text = 'Google'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <CALayer: 0x1096e8c0>>
The address of the UILabel object will be different each time we do this.
Anyway, we can print that label's font like this:
(lldb) po [0x1096e800 font]
$2 = 0x0bb88110 <UICFFont: 0xbb88110> font-family: ".Helvetica NeueUI"; font-weight: bold; font-style: normal; font-size: 13px
We can print its text color:
(lldb) po [0x1096e800 textColor]
$13 = 0x1096eb50 UIDeviceRGBColorSpace 0.173 0.212 0.259 0.9
We can also print its shadow color:
(lldb) po [0x1096e800 shadowColor]
$4 = 0x1096eb70 UIDeviceWhiteColorSpace 1 0.43
Printing the shadow offset is harder, because it is a CGSize structure, not a built-in type. The debugger doesn't know about CGSize because MobileSafari doesn't include debug information. We have to give the debugger a definition. This hideous command works:
(lldb) expr -o -- typedef struct { float x; float y; } CGSize; (id)[NSValue valueWithCGSize:(CGSize)[(id)0x1096e800 shadowOffset]]
$11 = 0x08063e60 NSSize: {0, 1}

It's the system's default font, Helvetica-Neue. In UIKit, you'd get it with [UIFont systemFontOfSize:...] or [UIFont boldSystemFontOfSize:...]. The "carve" effect is a simple white drop shadow. It's achieved with the shadowColor and shadowOffset properties of UILabel.

Related

How to use different "dev.off()" with knitr (to auto-crop figures)

I would like to use my own pdf() plot device in an .Rnw document converted to a PDF with knitr. After the PDF of a figure is generated
it should call pdfCrop.off() instead of dev.off() (or whatever knitr calls); this would
perfectly crop the resulting figures. How can this be done?
The following MWE works (but without cropping) if (*) is commented out (and the line before properly closed).
\documentclass{article}
\begin{document}
<<knitr_options, echo = FALSE, results = "hide", purl = FALSE>>=
## Custom graphics device (for cropping .pdf):
pdfCrop <- function(file, width, height, ...)
{
f <- file
grDevices::pdf(f, width = width, height = height, onefile = FALSE)
assign(".pdfCrop.file", f, envir = globalenv())
}
pdfCrop.off <- function() # used automagically
{
grDevices::dev.off() # closing the pdf device
f <- get(".pdfCrop.file", envir = globalenv())
system(paste("pdfcrop --pdftexcmd pdftex", f, f, "1>/dev/null 2>&1"),
intern = FALSE) # crop the file (relies on PATH)
}
## knitr options
knitr::opts_chunk$set(fig.path = "./fig_", background = "#FFFFFF",
dev = "pdfCrop", fig.ext = "pdf") # (*) => how to use pdfCrop.off() instead of dev.off()?
#
<<MWE>>=
<<fig-MWE, eval = FALSE, echo = FALSE>>=
plot(1:10, 10:1)
#
\setkeys{Gin}{width=\textwidth}
\begin{figure}[htbp]
\centering
\framebox{
<<figMWE, echo = FALSE, fig.width=6, fig.height=6>>=
<<fig-MWE>>
#
}
\caption{Just some text to show the actual textwidth in order to see that the
figure is not perfectly horizontally aligned due to some white space which can
be avoided by properly crop the figure with an adequate pdf crop device.}
\end{figure}
\end{document}
knitr already provides a crop device based on pdfcrop, so we can use that via a hook:
\documentclass{article}
\begin{document}
<<knitr_options, echo = FALSE, results = "hide", purl = FALSE>>=
## knitr options
library(knitr)
knit_hooks$set(crop = hook_pdfcrop)
knitr::opts_chunk$set(fig.path = "./fig_", # all figures are saved as fig_*
background = "#FFFFFF", # avoid color
crop = TRUE) # always crop
#
<<MWE>>=
<<fig-MWE, eval = FALSE, echo = FALSE>>=
plot(1:10, 10:1)
#
\setkeys{Gin}{width=\textwidth}
\begin{figure}[htbp]
\centering
<<figMWE, echo = FALSE, fig.width=6, fig.height=6>>=
<<fig-MWE>>
#
\caption{Just some text to show the actual textwidth in order to see that the
figure is not perfectly horizontally aligned due to some white space which can
be avoided by properly crop the figure with an adequate pdf crop device.}
\end{figure}
\end{document}

Add Pixel 3 & Pixel 3 XL into custom device settings

I would like to add the new Google phones to the Emulated Devices in Chrome's dev tools.
Does anyone know the correct custom device settings for the Pixel 3 and Pixel 3 XL?
You must enter the viewport size on the google dev center, not screen resolution. So the viewports for pixel 3 and pixel 3 xl are as below.
Pixel 3: 412 x 824 aspect ratio: 16:9 ~ Device pixel ratio: 1.7
Pixel 3 xl: 412 x 847 aspect ratio: 16:9 ~ Device pixel ratio: 1.7
you can use something like this to know you device details :
<!DOCTYPE html>
<html>
<body>
<button onclick="OutputDeviceInfo()">Click me</button>
<p id="width"></p>
<p id="height"></p>
<p id="ratio"></p>
<script>
function OutputDeviceInfo() {
let deviceWidth = window.screen.width;
let deviceHeight = window.screen.height;
let devicePixelAspectRation = window.devicePixelRatio;
document.getElementById("width").innerHTML = deviceWidth;
document.getElementById("height").innerHTML = deviceHeight;
document.getElementById("ratio").innerHTML = devicePixelAspectRation;
console.log('Width: ' + deviceWidth);
console.log('Height: ' + deviceHeight);
console.log('Pixel Ratio: ' + devicePixelAspectRation);
}
</script>
</body>
</html>
Press F12 on Chrome Browser >> Click on toggle device tool bar (on left side small mobile icon) >> click on drop-down option where you can see spme list of devices are there, you can see last option "Edit"- click on that Edit option>> click on "Add custom device" button enter the details for your targets device

API error: <_UIKBCompatInputView: 0x13fd1d7c0; frame = (0 0; 0 0); layer = <CALayer: 0x1c4426e40>> returned 0 width, assuming UIViewNoIntrinsicMetric

I'm using Ionic 3 on iPhone 7 plus with iOS 11. When I run my App, and fill in some text/input fields (basic forms) the app freezes for a few seconds and becomes completely unresponsive (which isn't good, not to say the least). I noticed this error coming up in Xcode, maybe that's the problem. Has anyone else encountered similar errors?
API error: <_UIKBCompatInputView: 0x13fd1d7c0; frame = (0 0; 0 0);
layer = > returned 0 width, assuming
UIViewNoIntrinsicMetric
Remove deprecated items from the forRoot config in app.module.ts
IonicModule.forRoot(),
Eg. remove these:
{
scrollPadding: true,
scrollAssist: false
}
See https://ionicframework.com/docs/utilities/config for more info.

Framer.js: how to get tap coordinates

I'm writing a Framer.js function to simulate the 'splash' effect when you tap a button or a layer, as per Google Material Design.
It looks something like this
tapSplash = (tapX,tapY) ->
tapSplashLayer = new layer
backgroundColor: "#ffffff"
opacity: 0.2
width: 500, height: 1500
borderRadius: 1500
midX: tapX
midY: tapY
After this, I have some code to run the animation.
My question is, how do I get the tapX and tapY coordinates? It is not good enough to use the midpoint of the layer that has been clicked/tapped - I want the animation to originate from the exact point the user tapped on
Check out your own answer to the question.
I've since then forked it and made changes so that taps on a computer or taps on a mobile device are recognized separately.
https://github.com/carignanboy1/Material-Design-Interactions/tree/improved-touch
touchEvent = Events.touchEvent(event)
if Utils.isPhone() || Utils.isTablet()
tX = touchEvent.clientX - layer.x
tY = touchEvent.clientY - layer.y
else
tX = touchEvent.offsetX
tY = touchEvent.offsetY

Issues with setting some different font for UILabel

I would like to set the font size and familyname to the titleLabel. //Helvetica Neue UltraLight
[titleLabel setFont:[UIFont fontWithName:#"Helvetica Neue UltraLight" size:25.0f]];
This is not working.
Kindly tell me what could be wrong?
Any help will be appreciated?
the correct fontName is #"HelveticaNeue-UltraLight".
use something like this to get a nicely formatted list of available font names:
NSMutableString *str = [NSMutableString stringWithCapacity:1000];
for (NSString *familyName in [UIFont familyNames]) {
[str appendFormat:#"%#\n", familyName];
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
[str appendFormat:#" %#\n", fontName];
}
[str appendString:#"\n"];
}
NSLog(#"%#", str);
this is the current list for iOS5.1:
Thonburi
Thonburi-Bold
Thonburi
Snell Roundhand
SnellRoundhand-Bold
SnellRoundhand-Black
SnellRoundhand
Academy Engraved LET
AcademyEngravedLetPlain
Marker Felt
MarkerFelt-Wide
MarkerFelt-Thin
Geeza Pro
GeezaPro-Bold
GeezaPro
Arial Rounded MT Bold
ArialRoundedMTBold
Trebuchet MS
TrebuchetMS
TrebuchetMS-Bold
TrebuchetMS-Italic
Trebuchet-BoldItalic
Arial
Arial-BoldMT
ArialMT
Arial-ItalicMT
Arial-BoldItalicMT
Marion
Marion-Regular
Marion-Bold
Marion-Italic
Gurmukhi MN
GurmukhiMN
GurmukhiMN-Bold
Malayalam Sangam MN
MalayalamSangamMN-Bold
MalayalamSangamMN
Bradley Hand
BradleyHandITCTT-Bold
Kannada Sangam MN
KannadaSangamMN
KannadaSangamMN-Bold
Bodoni 72 Oldstyle
BodoniSvtyTwoOSITCTT-Book
BodoniSvtyTwoOSITCTT-Bold
BodoniSvtyTwoOSITCTT-BookIt
Cochin
Cochin
Cochin-BoldItalic
Cochin-Italic
Cochin-Bold
Sinhala Sangam MN
SinhalaSangamMN
SinhalaSangamMN-Bold
Hiragino Kaku Gothic ProN
HiraKakuProN-W6
HiraKakuProN-W3
Papyrus
Papyrus-Condensed
Papyrus
Verdana
Verdana
Verdana-Bold
Verdana-BoldItalic
Verdana-Italic
Zapf Dingbats
ZapfDingbatsITC
Courier
Courier-Bold
Courier
Courier-BoldOblique
Courier-Oblique
Hoefler Text
HoeflerText-Black
HoeflerText-Italic
HoeflerText-Regular
HoeflerText-BlackItalic
Euphemia UCAS
EuphemiaUCAS-Bold
EuphemiaUCAS
EuphemiaUCAS-Italic
Helvetica
Helvetica-LightOblique
Helvetica
Helvetica-Oblique
Helvetica-BoldOblique
Helvetica-Bold
Helvetica-Light
Hiragino Mincho ProN
HiraMinProN-W3
HiraMinProN-W6
Bodoni Ornaments
BodoniOrnamentsITCTT
Apple Color Emoji
AppleColorEmoji
Optima
Optima-ExtraBlack
Optima-Italic
Optima-Regular
Optima-BoldItalic
Optima-Bold
Gujarati Sangam MN
GujaratiSangamMN
GujaratiSangamMN-Bold
Devanagari Sangam MN
DevanagariSangamMN
DevanagariSangamMN-Bold
Times New Roman
TimesNewRomanPS-ItalicMT
TimesNewRomanPS-BoldMT
TimesNewRomanPSMT
TimesNewRomanPS-BoldItalicMT
Kailasa
Kailasa
Kailasa-Bold
Telugu Sangam MN
TeluguSangamMN-Bold
TeluguSangamMN
Heiti SC
STHeitiSC-Medium
STHeitiSC-Light
Apple SD Gothic Neo
AppleSDGothicNeo-Bold
AppleSDGothicNeo-Medium
Futura
Futura-Medium
Futura-CondensedExtraBold
Futura-CondensedMedium
Futura-MediumItalic
Bodoni 72
BodoniSvtyTwoITCTT-BookIta
BodoniSvtyTwoITCTT-Book
BodoniSvtyTwoITCTT-Bold
Baskerville
Baskerville-SemiBoldItalic
Baskerville-Bold
Baskerville-Italic
Baskerville-BoldItalic
Baskerville-SemiBold
Baskerville
Chalkboard SE
ChalkboardSE-Regular
ChalkboardSE-Bold
ChalkboardSE-Light
Heiti TC
STHeitiTC-Medium
STHeitiTC-Light
Copperplate
Copperplate
Copperplate-Light
Copperplate-Bold
Party LET
PartyLetPlain
American Typewriter
AmericanTypewriter-CondensedLight
AmericanTypewriter-Light
AmericanTypewriter-Bold
AmericanTypewriter
AmericanTypewriter-CondensedBold
AmericanTypewriter-Condensed
Bangla Sangam MN
BanglaSangamMN-Bold
BanglaSangamMN
Noteworthy
Noteworthy-Light
Noteworthy-Bold
Zapfino
Zapfino
Tamil Sangam MN
TamilSangamMN
TamilSangamMN-Bold
DB LCD Temp
DBLCDTempBlack
Arial Hebrew
ArialHebrew
ArialHebrew-Bold
Chalkduster
Chalkduster
Georgia
Georgia-Italic
Georgia-BoldItalic
Georgia-Bold
Georgia
Helvetica Neue
HelveticaNeue-Bold
HelveticaNeue-CondensedBlack
HelveticaNeue-Medium
HelveticaNeue
HelveticaNeue-Light
HelveticaNeue-CondensedBold
HelveticaNeue-LightItalic
HelveticaNeue-UltraLightItalic
HelveticaNeue-UltraLight
HelveticaNeue-BoldItalic
HelveticaNeue-Italic
Gill Sans
GillSans-LightItalic
GillSans-BoldItalic
GillSans-Italic
GillSans
GillSans-Bold
GillSans-Light
Palatino
Palatino-Roman
Palatino-Bold
Palatino-BoldItalic
Palatino-Italic
Courier New
CourierNewPSMT
CourierNewPS-BoldMT
CourierNewPS-BoldItalicMT
CourierNewPS-ItalicMT
Oriya Sangam MN
OriyaSangamMN-Bold
OriyaSangamMN
Didot
Didot-Italic
Didot
Didot-Bold
Bodoni 72 Smallcaps
BodoniSvtyTwoSCITCTT-Book
You use wrong font name, correct one will be:
[titleLabel setFont:[UIFont fontWithName:#"HelveticaNeue-UltraLight" size:25.0f]];
You can see the list of all available font names for a given font family using +fontNamesForFamilyName: method in UIFont, e.g.:
[UIFont fontNamesForFamilyName:#"Helvetica Neue"]
Edit: Also mind that some fonts may not be present on all versions of iOS as Apple gradually adds (and sometimes probably removes) fonts from standard OS set.
It appears that "HelveticaNeue-UltraLight" font present in OS starting 5.0 version. If you want to use it in older OS versions you'll need to embed it to you application - check for example this answer for details how to do that
Please see List of Fonts available in iOS
and use font names according this...