font-size

iOS - How to use `NSMutableString` in swift

橙三吉。 提交于 2019-12-03 16:25:45
I have seen this Objective-C code but I'm struggling to do the same in swift: NSMutableAttributedString *res = [self.richTextEditor.attributedText mutableCopy]; [res beginEditing]; __block BOOL found = NO; [res enumerateAttribute:NSFontAttributeName inRange:NSMakeRange(0, res.length) options:0 usingBlock:^(id value, NSRange range, BOOL *stop) { if (value) { UIFont *oldFont = (UIFont *)value; UIFont *newFont = [oldFont fontWithSize:oldFont.pointSize * 2]; [res removeAttribute:NSFontAttributeName range:range]; [res addAttribute:NSFontAttributeName value:newFont range:range]; found = YES; } }];

iOS: How to set font when drawing text in pdf generation?

ε祈祈猫儿з 提交于 2019-12-03 16:13:37
I'am generating a pdf in ios app, using drawpdf function,while calling the drawtext function in the nsobject class it draws the text clearly according to the frame and string which I specified. My code is +(void)drawText:(NSString*)textToDraw inFrame:(CGRect)frameRect { CFStringRef stringRef = (__bridge CFStringRef)textToDraw; // Prepare the text using a Core Text Framesetter CFAttributedStringRef currentText = CFAttributedStringCreate(NULL, stringRef, NULL); CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(currentText); CGMutablePathRef framePath = CGPathCreateMutable();

「前端」rem 缩放方案 flexible-js 兼容 375px 方案的思路

▼魔方 西西 提交于 2019-12-03 15:05:41
本文来自尚妆前端团队 南洋 发表于 尚妆github博客 ,欢迎订阅。 移动端H5页面rem缩放方案flexible.js兼容375px方案的思路 参考: 移动端高清、多屏适配方案 viewport-and-flexible.js flexible.js github 一个新的项目复用了一些老页面,老页面是使用375px方案进行移动端适配的,meta[viewport]使用的是 <meta name="viewport" content="width=375, user-scalabe=no"> ,而新页面使用的是flexible.js伸缩方案,动态生成meta[viewport] <meta name="viewport" content="initial-scale=[num], user-scalabe=no"> 如何在老页面使用px布局的前提下,新页面使用rem布局,组件也使用rem布局,并且组件可以兼容老页面和新页面是本文的结果。 首先会介绍375px方案和rem方案的实现原理。 375px方案 <meta name="viewport" content="width=375, user-scalabe=no"> 375px方案的页面开发过程对新人非常的友好,利用页面的布局视口(layout viewport)为固定值375px,和移动端浏览器窗口的自动缩放功能(视觉视口

css-总结

末鹿安然 提交于 2019-12-03 14:10:11
1、 css基本语法 css页面引入方法: 1、外联式:通过link标签,连接到外部样式表到页面中 <link rel="stylesheet" type="text/css" href="CSS/main.css"> 2、嵌入式:通过style 标签,在网页上创建嵌入式的样式表 <style type="text/css"> h1{ font-size:20px; color: blue; } </style> 3、内联式:通过标签的style 属性,在标签上直接写样式 <a href="https://www.baidu.com/" style="font-size:24px; color:yellow;">百度</a>2、 css文本设置 color:设置文字的颜色:如:color:red; font-size:设置文字的大小:如font-size:12px; font-family:设置文字的字体:如font-family:'微软雅黑'; font-style:设置字体是否倾斜: 如font-style:'normal';设置不倾斜 如font-style:'italic';设置倾斜 font-weight:设置文字是否加粗 如font-weight:bold; 设置加粗 如font-weight:normal; 设置不加粗 line-height 设置文字的间距

Change font type and size of UIActionSheet title string

时光毁灭记忆、已成空白 提交于 2019-12-03 13:55:27
问题 I have a UIActionSheet with title string "DO: These tasks". In the title string, the substring "DO:" should be Bold(with a particular font size) and the substring "These tasks" should be Regular. Is it possible? How can I do this? 回答1: I assume you have a class which implements the UIActionSheetDelegate protocol and your class is a delegate class of the current UIActionSheet , so in that class you can change the whole title of the UIActionSheet like - (void)willPresentActionSheet:

Adjust font size of Android WebView

僤鯓⒐⒋嵵緔 提交于 2019-12-03 13:43:07
问题 How do you adjust the font size of an Android WebView ? The following appears to have no effect: private void fontSizePlus() { fontSize = (fontSize < FONT_SIZE_MAX) ? fontSize + FONT_SIZE_INCREMENT : fontSize; this.changeFontSize(fontSize); } private void fontSizeMinus() { fontSize = (fontSize > FONT_SIZE_MIN) ? fontSize - FONT_SIZE_INCREMENT : fontSize; this.changeFontSize(fontSize); } private void changeFontSize(int value) { String js = "document.getElementsByTagName('body')[0].style

How to use a different coordinate system in WPF? (scaling only)

妖精的绣舞 提交于 2019-12-03 12:58:55
(Let me give you some context) I am currently designing an application that is supposed to generate a printable A4 page based on some data. Naturally, the device independent pixels of WPF (96 pixels/inch) are not a very natural unit of measurement in the paper world. Something like millimetres would be more appropriate. So I got my calculator out and arrived at a scaling factor of something around 3.779. It turns out that simply slapping everything that's supposed to go on the page in a ScaleTransform has one nasty side effect: Font sizes are scaled too (naturally). This, however, is not what

IE8 font-size toggles on :hover - Japanese lang only

怎甘沉沦 提交于 2019-12-03 12:57:08
I have a page that is multi lingual and I have an issue with the Japanese version only. For some reason in IE8, when I hover over an element, a sibling's font-size will increase/decrease. Even stranger, is that this doesn't happen on every hover, sometimes I cannot reproduce straight away, I need to keep hovering over different elements in the same area of the page. Eventually this bug will rear its ugly head. This bug only occurs on the Japanese page, all other languages seem to be fine. This could be happening on other versions of Internet explorer, I haven't tested on all. To clarify, I

CSS(2)---css字体、文本样式属性

喜欢而已 提交于 2019-12-03 12:13:18
css字体、文本样式属性 这篇主要讲CSS文本属性中的: 字体样式属性 和 文本样式属性 。 一、字体样式属性 CSS 字体属性主要包括: 字体设置(font-family) 、 字号大小(font-size) 、 字体粗细(font-weight) 、 字体风格(font-style) 、 字体颜色(color) 。 1、字体设置(font-family) 网页中常用的字体有 宋体、微软雅黑、黑体 等,例如将网页中 所有p标签的字体设置为微软雅黑 ,可以使用如下CSS样式代码: p { font-family:"微软雅黑";} 可以同时指定多个字体,中间以 逗号 隔开,表示如果浏览器不支持第一个字体,则会尝试下一个,直到找到合适的字体。 p {font-family:"微软雅黑",“宋体”,arial;} 注意 1、英文字体不需要加双引号,如:选择器{font-family:arial;} 2、如字体中包含特殊符号必须用双引号括起来,如:选择器{font-family:"Microsoft yahei";} 3、尽量使用系统默认字体,保证在任何用户的浏览器中都能正确显示。 2、字号大小(font-size) p {font-size:15px;} 该属性的值可以使用相对长度单位,也可以使用绝对长度单位。较常用,推荐使用相对长度像素单位px。 建议 1

响应式布局之 px、em、 rem

心不动则不痛 提交于 2019-12-03 12:08:16
一、写在前面的话   作为一面前端开发者,对 px 、em 、 rem 应该是再熟悉不过了,但大多数小伙伴应该都和我一样仅仅停留在了解的层面,并不是实质性的掌握它们。本文对三者进行了详细的总结和详细说明,不熟悉的各位小伙伴阅读本文一定会有所收获,如果你对这三者已经了解的非常透彻,那本文可能对你的帮助不大。 二、简述   px、em、rem都是计量单位,都能表示尺寸,但是有有所不同,而且其各有各的优缺点。 三、PX (pixel)   Px 表示“绝对尺寸”(并非真正的绝对),实际上就是css中定义的像素(此像素与设备的物理像素有一定的区别),利用px设置字体大小及元素宽高等比较稳定和精确。Px的缺点是其不能适应浏览器缩放时产生的变化,因此一般不用于响应式网站。 注: 1、像素 1024x768 的,表示的是水平方向是 1024 个像素点,垂直方向是 768个 像素点。   2、以上所述 px 为 css 中定义的像素(以下简称 css 像素),与实际的物理像素是有区别的,早期电脑屏幕的物理像素与 css 像素相同,但是随着科技的发展,高精度屏幕开始出现在人们的视野中。以 iPhone 的 Retina  屏为例,其物理像素与 css 像素关系见下图。   为此移动端浏览器以及某些桌面浏览器引入了 devicePixelRatio(DPR 设备像素比)属性,其官方的定义为